| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 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_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/profiles/profile_attributes_storage.h" | 8 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 9 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
| 9 #include "ui/views/window/non_client_view.h" | 10 #include "ui/views/window/non_client_view.h" |
| 10 | 11 |
| 11 class AvatarMenuButton; | |
| 12 class BrowserFrame; | 12 class BrowserFrame; |
| 13 class BrowserView; | 13 class BrowserView; |
| 14 | 14 |
| 15 // A specialization of the NonClientFrameView object that provides additional | 15 // A specialization of the NonClientFrameView object that provides additional |
| 16 // Browser-specific methods. | 16 // Browser-specific methods. |
| 17 class BrowserNonClientFrameView : public views::NonClientFrameView, | 17 class BrowserNonClientFrameView : public views::NonClientFrameView, |
| 18 public ProfileAttributesStorage::Observer { | 18 public ProfileAttributesStorage::Observer { |
| 19 public: | 19 public: |
| 20 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); | 20 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 21 ~BrowserNonClientFrameView() override; | 21 ~BrowserNonClientFrameView() override; |
| 22 | 22 |
| 23 BrowserView* browser_view() const { return browser_view_; } | 23 BrowserView* browser_view() const { return browser_view_; } |
| 24 BrowserFrame* frame() const { return frame_; } | 24 BrowserFrame* frame() const { return frame_; } |
| 25 AvatarMenuButton* avatar_button() const { return avatar_button_; } | |
| 26 | 25 |
| 27 // Called when BrowserView creates all it's child views. | 26 // Called when BrowserView creates all it's child views. |
| 28 virtual void OnBrowserViewInitViewsComplete(); | 27 virtual void OnBrowserViewInitViewsComplete(); |
| 29 | 28 |
| 30 // Retrieves the bounds, in non-client view coordinates within which the | 29 // Retrieves the bounds, in non-client view coordinates within which the |
| 31 // TabStrip should be laid out. | 30 // TabStrip should be laid out. |
| 32 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; | 31 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; |
| 33 | 32 |
| 34 // Returns the inset of the topmost view in the client view from the top of | 33 // Returns the inset of the topmost view in the client view from the top of |
| 35 // the non-client view. The topmost view depends on the window type. The | 34 // the non-client view. The topmost view depends on the window type. The |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 SkColor GetFrameColor(bool active) const; | 74 SkColor GetFrameColor(bool active) const; |
| 76 gfx::ImageSkia GetFrameImage(bool active) const; | 75 gfx::ImageSkia GetFrameImage(bool active) const; |
| 77 gfx::ImageSkia GetFrameOverlayImage(bool active) const; | 76 gfx::ImageSkia GetFrameOverlayImage(bool active) const; |
| 78 | 77 |
| 79 // Convenience versions of the above which use ShouldPaintAsActive() for | 78 // Convenience versions of the above which use ShouldPaintAsActive() for |
| 80 // |active|. | 79 // |active|. |
| 81 SkColor GetFrameColor() const; | 80 SkColor GetFrameColor() const; |
| 82 gfx::ImageSkia GetFrameImage() const; | 81 gfx::ImageSkia GetFrameImage() const; |
| 83 gfx::ImageSkia GetFrameOverlayImage() const; | 82 gfx::ImageSkia GetFrameOverlayImage() const; |
| 84 | 83 |
| 85 // Update the profile switcher button if one should exist. Otherwise, update | 84 // Updates the profile switcher button if one should exist. Otherwise, updates |
| 86 // the incognito avatar, or profile avatar for teleported frames in ChromeOS. | 85 // the icon that indicates incognito (or a teleported window in ChromeOS). |
| 87 virtual void UpdateAvatar() = 0; | 86 virtual void UpdateProfileIcons() = 0; |
| 88 | 87 |
| 89 // Updates the title and icon of the old avatar button. | 88 // Updates the icon that indicates incognito/teleportation state. |
| 90 void UpdateOldAvatarButton(); | 89 void UpdateProfileIndicatorIcon(); |
| 90 |
| 91 const views::View* profile_indicator_icon() const { |
| 92 return profile_indicator_icon_; |
| 93 } |
| 94 views::View* profile_indicator_icon() { |
| 95 return profile_indicator_icon_; |
| 96 } |
| 91 | 97 |
| 92 private: | 98 private: |
| 93 // views::NonClientFrameView: | 99 // views::NonClientFrameView: |
| 94 void ViewHierarchyChanged( | 100 void ViewHierarchyChanged( |
| 95 const ViewHierarchyChangedDetails& details) override; | 101 const ViewHierarchyChangedDetails& details) override; |
| 96 void ActivationChanged(bool active) override; | 102 void ActivationChanged(bool active) override; |
| 97 | 103 |
| 98 // ProfileAttributesStorage::Observer: | 104 // ProfileAttributesStorage::Observer: |
| 99 void OnProfileAdded(const base::FilePath& profile_path) override; | 105 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 100 void OnProfileWasRemoved(const base::FilePath& profile_path, | 106 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 101 const base::string16& profile_name) override; | 107 const base::string16& profile_name) override; |
| 102 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 108 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 103 | 109 |
| 104 // Gets a theme provider that should be non-null even before we're added to a | 110 // Gets a theme provider that should be non-null even before we're added to a |
| 105 // view hierarchy. | 111 // view hierarchy. |
| 106 const ui::ThemeProvider* GetThemeProviderForProfile() const; | 112 const ui::ThemeProvider* GetThemeProviderForProfile() const; |
| 107 | 113 |
| 108 // Draws a taskbar icon if avatars are enabled, erases it otherwise. | 114 // Draws a taskbar icon if avatars are enabled, erases it otherwise. |
| 109 void UpdateTaskbarDecoration(); | 115 void UpdateTaskbarDecoration(); |
| 110 | 116 |
| 111 // The frame that hosts this view. | 117 // The frame that hosts this view. |
| 112 BrowserFrame* frame_; | 118 BrowserFrame* frame_; |
| 113 | 119 |
| 114 // The BrowserView hosted within this View. | 120 // The BrowserView hosted within this View. |
| 115 BrowserView* browser_view_; | 121 BrowserView* browser_view_; |
| 116 | 122 |
| 117 // Menu button that displays the incognito icon. May be null for some frame | 123 // On desktop, this is used to show an incognito icon. On CrOS, it's also used |
| 118 // styles. TODO(anthonyvd): simplify/rename. | 124 // for teleported windows (in multi-profile mode). |
| 119 AvatarMenuButton* avatar_button_ = nullptr; | 125 ProfileIndicatorIcon* profile_indicator_icon_; |
| 120 | 126 |
| 121 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView); | 127 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView); |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 namespace chrome { | 130 namespace chrome { |
| 125 | 131 |
| 126 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 132 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
| 127 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 133 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
| 128 BrowserFrame* frame, BrowserView* browser_view); | 134 BrowserFrame* frame, BrowserView* browser_view); |
| 129 | 135 |
| 130 } // namespace chrome | 136 } // namespace chrome |
| 131 | 137 |
| 132 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 138 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
| OLD | NEW |