browser_non_client_frame_view.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 6#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "ui/views/window/non_client_view.h" 10 11class AvatarMenuButton; 12class BrowserFrame; 13class BrowserView; 14 15// A specialization of the NonClientFrameView object that provides additional 16// Browser-specific methods. 17class BrowserNonClientFrameView : public views::NonClientFrameView { 18 public: 19 // Insets around the tabstrip. 20 struct TabStripInsets { 21 TabStripInsets() : top(0), left(0), right(0) {} 22 TabStripInsets(int top, int left, int right) 23 : top(top), 24 left(left), 25 right(right) {} 26 27 int top; 28 int left; 29 int right; 30 }; 31 32 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); 33 virtual ~BrowserNonClientFrameView(); 34 35 AvatarMenuButton* avatar_button() const { return avatar_button_.get(); } 36 37 // Returns the bounds within which the TabStrip should be laid out. 38 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; 39 40 // Returns the TabStripInsets within the window at which the tab strip is 41 // positioned. If |as_restored| is true, this is calculated as if we were in 42 // restored mode regardless of the current mode. 43 virtual TabStripInsets GetTabStripInsets(bool force_restored) const = 0; 44 45 // Returns the amount that the theme background should be inset. 46 virtual int GetThemeBackgroundXInset() const = 0; 47 48 // Updates the throbber. 49 virtual void UpdateThrobber(bool running) = 0; 50 51 // Overriden from views::View. 52 virtual void VisibilityChanged(views::View* starting_from, 53 bool is_visible) OVERRIDE; 54 55 protected: 56 BrowserView* browser_view() const { return browser_view_; } 57 BrowserFrame* frame() const { return frame_; } 58 59 // Updates the title and icon of the avatar button. 60 void UpdateAvatarInfo(); 61 62 private: 63 // The frame that hosts this view. 64 BrowserFrame* frame_; 65 66 // The BrowserView hosted within this View. 67 BrowserView* browser_view_; 68 69 // Menu button that displays that either the incognito icon or the profile 70 // icon. May be NULL for some frame styles. 71 scoped_ptr<AvatarMenuButton> avatar_button_; 72}; 73 74namespace chrome { 75 76// Provided by a browser_non_client_frame_view_factory_*.cc implementation 77BrowserNonClientFrameView* CreateBrowserNonClientFrameView( 78 BrowserFrame* frame, BrowserView* browser_view); 79 80} // namespace chrome 81 82#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 83