| 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_OPAQUE_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_frame.h" | 10 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 12 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegat
e.h" | 12 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegat
e.h" |
| 13 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 13 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
| 14 #include "content/public/browser/notification_observer.h" | |
| 15 #include "content/public/browser/notification_registrar.h" | |
| 16 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
| 17 #include "ui/views/controls/button/menu_button_listener.h" | 15 #include "ui/views/controls/button/menu_button_listener.h" |
| 18 #include "ui/views/window/non_client_view.h" | 16 #include "ui/views/window/non_client_view.h" |
| 19 | 17 |
| 20 class BrowserView; | 18 class BrowserView; |
| 21 class OpaqueBrowserFrameViewLayout; | 19 class OpaqueBrowserFrameViewLayout; |
| 22 class OpaqueBrowserFrameViewPlatformSpecific; | 20 class OpaqueBrowserFrameViewPlatformSpecific; |
| 23 class TabIconView; | 21 class TabIconView; |
| 24 class NewAvatarButton; | 22 class NewAvatarButton; |
| 25 | 23 |
| 26 namespace views { | 24 namespace views { |
| 27 class ImageButton; | 25 class ImageButton; |
| 28 class FrameBackground; | 26 class FrameBackground; |
| 29 class Label; | 27 class Label; |
| 30 } | 28 } |
| 31 | 29 |
| 32 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, | 30 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
| 33 public content::NotificationObserver, | |
| 34 public views::ButtonListener, | 31 public views::ButtonListener, |
| 35 public views::MenuButtonListener, | 32 public views::MenuButtonListener, |
| 36 public chrome::TabIconViewModel, | 33 public chrome::TabIconViewModel, |
| 37 public OpaqueBrowserFrameViewLayoutDelegate { | 34 public OpaqueBrowserFrameViewLayoutDelegate { |
| 38 public: | 35 public: |
| 39 // Constructs a non-client view for an BrowserFrame. | 36 // Constructs a non-client view for an BrowserFrame. |
| 40 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 37 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 41 ~OpaqueBrowserFrameView() override; | 38 ~OpaqueBrowserFrameView() override; |
| 42 | 39 |
| 43 // BrowserNonClientFrameView: | 40 // BrowserNonClientFrameView: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 62 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 66 | 63 |
| 67 // views::MenuButtonListener: | 64 // views::MenuButtonListener: |
| 68 void OnMenuButtonClicked(views::View* source, | 65 void OnMenuButtonClicked(views::View* source, |
| 69 const gfx::Point& point) override; | 66 const gfx::Point& point) override; |
| 70 | 67 |
| 71 // chrome::TabIconViewModel: | 68 // chrome::TabIconViewModel: |
| 72 bool ShouldTabIconViewAnimate() const override; | 69 bool ShouldTabIconViewAnimate() const override; |
| 73 gfx::ImageSkia GetFaviconForTabIconView() override; | 70 gfx::ImageSkia GetFaviconForTabIconView() override; |
| 74 | 71 |
| 75 // content::NotificationObserver implementation: | |
| 76 void Observe(int type, | |
| 77 const content::NotificationSource& source, | |
| 78 const content::NotificationDetails& details) override; | |
| 79 | |
| 80 // OpaqueBrowserFrameViewLayoutDelegate implementation: | 72 // OpaqueBrowserFrameViewLayoutDelegate implementation: |
| 81 bool ShouldShowWindowIcon() const override; | 73 bool ShouldShowWindowIcon() const override; |
| 82 bool ShouldShowWindowTitle() const override; | 74 bool ShouldShowWindowTitle() const override; |
| 83 base::string16 GetWindowTitle() const override; | 75 base::string16 GetWindowTitle() const override; |
| 84 int GetIconSize() const override; | 76 int GetIconSize() const override; |
| 85 bool ShouldLeaveOffsetNearTopBorder() const override; | 77 bool ShouldLeaveOffsetNearTopBorder() const override; |
| 86 gfx::Size GetBrowserViewMinimumSize() const override; | 78 gfx::Size GetBrowserViewMinimumSize() const override; |
| 87 bool ShouldShowCaptionButtons() const override; | 79 bool ShouldShowCaptionButtons() const override; |
| 88 bool ShouldShowAvatar() const override; | 80 bool ShouldShowAvatar() const override; |
| 89 bool IsRegularOrGuestSession() const override; | 81 bool IsRegularOrGuestSession() const override; |
| 90 gfx::ImageSkia GetOTRAvatarIcon() const override; | 82 gfx::ImageSkia GetOTRAvatarIcon() const override; |
| 91 bool IsMaximized() const override; | 83 bool IsMaximized() const override; |
| 92 bool IsMinimized() const override; | 84 bool IsMinimized() const override; |
| 93 bool IsFullscreen() const override; | 85 bool IsFullscreen() const override; |
| 94 bool IsTabStripVisible() const override; | 86 bool IsTabStripVisible() const override; |
| 95 int GetTabStripHeight() const override; | 87 int GetTabStripHeight() const override; |
| 96 gfx::Size GetTabstripPreferredSize() const override; | 88 gfx::Size GetTabstripPreferredSize() const override; |
| 97 | 89 |
| 98 protected: | 90 protected: |
| 99 views::ImageButton* minimize_button() const { return minimize_button_; } | 91 views::ImageButton* minimize_button() const { return minimize_button_; } |
| 100 views::ImageButton* maximize_button() const { return maximize_button_; } | 92 views::ImageButton* maximize_button() const { return maximize_button_; } |
| 101 views::ImageButton* restore_button() const { return restore_button_; } | 93 views::ImageButton* restore_button() const { return restore_button_; } |
| 102 views::ImageButton* close_button() const { return close_button_; } | 94 views::ImageButton* close_button() const { return close_button_; } |
| 103 | 95 |
| 104 // views::View: | 96 // views::View: |
| 105 void OnPaint(gfx::Canvas* canvas) override; | 97 void OnPaint(gfx::Canvas* canvas) override; |
| 106 | 98 |
| 99 // BrowserNonClientFrameView: |
| 100 void UpdateNewStyleAvatar() override; |
| 101 |
| 107 private: | 102 private: |
| 108 // views::NonClientFrameView: | 103 // views::NonClientFrameView: |
| 109 bool DoesIntersectRect(const views::View* target, | 104 bool DoesIntersectRect(const views::View* target, |
| 110 const gfx::Rect& rect) const override; | 105 const gfx::Rect& rect) const override; |
| 111 | 106 |
| 112 // Creates, adds and returns a new image button with |this| as its listener. | 107 // Creates, adds and returns a new image button with |this| as its listener. |
| 113 // Memory is owned by the caller. | 108 // Memory is owned by the caller. |
| 114 views::ImageButton* InitWindowCaptionButton(int normal_image_id, | 109 views::ImageButton* InitWindowCaptionButton(int normal_image_id, |
| 115 int hot_image_id, | 110 int hot_image_id, |
| 116 int pushed_image_id, | 111 int pushed_image_id, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Window controls. | 159 // Window controls. |
| 165 views::ImageButton* minimize_button_; | 160 views::ImageButton* minimize_button_; |
| 166 views::ImageButton* maximize_button_; | 161 views::ImageButton* maximize_button_; |
| 167 views::ImageButton* restore_button_; | 162 views::ImageButton* restore_button_; |
| 168 views::ImageButton* close_button_; | 163 views::ImageButton* close_button_; |
| 169 | 164 |
| 170 // The window icon and title. | 165 // The window icon and title. |
| 171 TabIconView* window_icon_; | 166 TabIconView* window_icon_; |
| 172 views::Label* window_title_; | 167 views::Label* window_title_; |
| 173 | 168 |
| 174 content::NotificationRegistrar registrar_; | |
| 175 | |
| 176 // Background painter for the window frame. | 169 // Background painter for the window frame. |
| 177 scoped_ptr<views::FrameBackground> frame_background_; | 170 scoped_ptr<views::FrameBackground> frame_background_; |
| 178 | 171 |
| 179 // Observer that handles platform dependent configuration. | 172 // Observer that handles platform dependent configuration. |
| 180 scoped_ptr<OpaqueBrowserFrameViewPlatformSpecific> platform_observer_; | 173 scoped_ptr<OpaqueBrowserFrameViewPlatformSpecific> platform_observer_; |
| 181 | 174 |
| 182 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); | 175 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); |
| 183 }; | 176 }; |
| 184 | 177 |
| 185 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 178 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |