| 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 "base/scoped_observer.h" |
| 8 #include "chrome/browser/profiles/profile_attributes_storage.h" | 9 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 10 #include "ui/views/widget/widget_observer.h" |
| 9 #include "ui/views/window/non_client_view.h" | 11 #include "ui/views/window/non_client_view.h" |
| 10 | 12 |
| 11 class AvatarMenuButton; | 13 class AvatarMenuButton; |
| 12 class BrowserFrame; | 14 class BrowserFrame; |
| 13 class BrowserView; | 15 class BrowserView; |
| 14 | 16 |
| 15 // A specialization of the NonClientFrameView object that provides additional | 17 // A specialization of the NonClientFrameView object that provides additional |
| 16 // Browser-specific methods. | 18 // Browser-specific methods. |
| 17 class BrowserNonClientFrameView : public views::NonClientFrameView, | 19 class BrowserNonClientFrameView : public views::NonClientFrameView, |
| 20 public views::WidgetObserver, |
| 18 public ProfileAttributesStorage::Observer { | 21 public ProfileAttributesStorage::Observer { |
| 19 public: | 22 public: |
| 20 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); | 23 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 21 ~BrowserNonClientFrameView() override; | 24 ~BrowserNonClientFrameView() override; |
| 22 | 25 |
| 23 BrowserView* browser_view() const { return browser_view_; } | 26 BrowserView* browser_view() const { return browser_view_; } |
| 24 BrowserFrame* frame() const { return frame_; } | 27 BrowserFrame* frame() const { return frame_; } |
| 25 AvatarMenuButton* avatar_button() const { return avatar_button_; } | 28 AvatarMenuButton* avatar_button() const { return avatar_button_; } |
| 26 | 29 |
| 27 // Called when BrowserView creates all it's child views. | 30 // Called when BrowserView creates all it's child views. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 virtual void UpdateAvatar() = 0; | 86 virtual void UpdateAvatar() = 0; |
| 84 | 87 |
| 85 // Updates the title and icon of the old avatar button. | 88 // Updates the title and icon of the old avatar button. |
| 86 void UpdateOldAvatarButton(); | 89 void UpdateOldAvatarButton(); |
| 87 | 90 |
| 88 private: | 91 private: |
| 89 // views::NonClientFrameView: | 92 // views::NonClientFrameView: |
| 90 void ViewHierarchyChanged( | 93 void ViewHierarchyChanged( |
| 91 const ViewHierarchyChangedDetails& details) override; | 94 const ViewHierarchyChangedDetails& details) override; |
| 92 | 95 |
| 96 // views::WidgetObserver: |
| 97 void OnWidgetDestroyed(views::Widget* widget) override; |
| 98 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
| 99 |
| 93 // ProfileAttributesStorage::Observer: | 100 // ProfileAttributesStorage::Observer: |
| 94 void OnProfileAdded(const base::FilePath& profile_path) override; | 101 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 95 void OnProfileWasRemoved(const base::FilePath& profile_path, | 102 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 96 const base::string16& profile_name) override; | 103 const base::string16& profile_name) override; |
| 97 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 104 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 98 | 105 |
| 99 // Gets a theme provider that should be non-null even before we're added to a | 106 // Gets a theme provider that should be non-null even before we're added to a |
| 100 // view hierarchy. | 107 // view hierarchy. |
| 101 const ui::ThemeProvider* GetThemeProviderForProfile() const; | 108 const ui::ThemeProvider* GetThemeProviderForProfile() const; |
| 102 | 109 |
| 103 // Draws a taskbar icon if avatars are enabled, erases it otherwise. | 110 // Draws a taskbar icon if avatars are enabled, erases it otherwise. |
| 104 void UpdateTaskbarDecoration(); | 111 void UpdateTaskbarDecoration(); |
| 105 | 112 |
| 106 // The frame that hosts this view. | 113 // The frame that hosts this view. |
| 107 BrowserFrame* frame_; | 114 BrowserFrame* frame_; |
| 108 | 115 |
| 109 // The BrowserView hosted within this View. | 116 // The BrowserView hosted within this View. |
| 110 BrowserView* browser_view_; | 117 BrowserView* browser_view_; |
| 111 | 118 |
| 112 // Menu button that displays the incognito icon. May be null for some frame | 119 // Menu button that displays the incognito icon. May be null for some frame |
| 113 // styles. TODO(anthonyvd): simplify/rename. | 120 // styles. TODO(anthonyvd): simplify/rename. |
| 114 AvatarMenuButton* avatar_button_ = nullptr; | 121 AvatarMenuButton* avatar_button_ = nullptr; |
| 115 | 122 |
| 123 ScopedObserver<views::Widget, views::WidgetObserver> observer_; |
| 124 |
| 116 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView); | 125 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView); |
| 117 }; | 126 }; |
| 118 | 127 |
| 119 namespace chrome { | 128 namespace chrome { |
| 120 | 129 |
| 121 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 130 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
| 122 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 131 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
| 123 BrowserFrame* frame, BrowserView* browser_view); | 132 BrowserFrame* frame, BrowserView* browser_view); |
| 124 | 133 |
| 125 } // namespace chrome | 134 } // namespace chrome |
| 126 | 135 |
| 127 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 136 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
| OLD | NEW |