browser_non_client_frame_view.h revision 868fa2fe829687343ffae624259930155e16dbd8
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 15namespace views { 16class Label; 17} 18 19// A specialization of the NonClientFrameView object that provides additional 20// Browser-specific methods. 21class BrowserNonClientFrameView : public views::NonClientFrameView { 22 public: 23 // Insets around the tabstrip. 24 struct TabStripInsets { 25 TabStripInsets() : top(0), left(0), right(0) {} 26 TabStripInsets(int top, int left, int right) 27 : top(top), 28 left(left), 29 right(right) {} 30 31 int top; 32 int left; 33 int right; 34 }; 35 36 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); 37 virtual ~BrowserNonClientFrameView(); 38 39 AvatarMenuButton* avatar_button() const { return avatar_button_.get(); } 40 41 views::Label* avatar_label() const { return avatar_label_.get(); } 42 43 // Returns the bounds within which the TabStrip should be laid out. 44 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; 45 46 // Returns the TabStripInsets within the window at which the tab strip is 47 // positioned. If |as_restored| is true, this is calculated as if we were in 48 // restored mode regardless of the current mode. 49 virtual TabStripInsets GetTabStripInsets(bool force_restored) const = 0; 50 51 // Returns the amount that the theme background should be inset. 52 virtual int GetThemeBackgroundXInset() const = 0; 53 54 // Updates the throbber. 55 virtual void UpdateThrobber(bool running) = 0; 56 57 // Overriden from views::View. 58 virtual void VisibilityChanged(views::View* starting_from, 59 bool is_visible) OVERRIDE; 60 virtual void OnThemeChanged() OVERRIDE; 61 62 protected: 63 BrowserView* browser_view() const { return browser_view_; } 64 BrowserFrame* frame() const { return frame_; } 65 66 // Determine the color of the label text and the label background. 67 void UpdateAvatarLabelStyle(); 68 69 // Updates the title and icon of the avatar button. 70 void UpdateAvatarInfo(); 71 72 private: 73 // The frame that hosts this view. 74 BrowserFrame* frame_; 75 76 // The BrowserView hosted within this View. 77 BrowserView* browser_view_; 78 79 // Menu button that displays that either the incognito icon or the profile 80 // icon. May be NULL for some frame styles. 81 scoped_ptr<AvatarMenuButton> avatar_button_; 82 83 // Avatar label that is used for a managed user. 84 scoped_ptr<views::Label> avatar_label_; 85}; 86 87namespace chrome { 88 89// Provided by a browser_non_client_frame_view_factory_*.cc implementation 90BrowserNonClientFrameView* CreateBrowserNonClientFrameView( 91 BrowserFrame* frame, BrowserView* browser_view); 92 93} // namespace chrome 94 95#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 96