| 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_ASH_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| 7 | 7 |
| 8 #include "ash/shell_observer.h" | 8 #include "ash/shell_observer.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/command_observer.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 12 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 13 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
| 14 #include "ui/views/controls/button/button.h" |
| 13 | 15 |
| 14 class TabIconView; | 16 class TabIconView; |
| 15 | 17 |
| 16 namespace ash { | 18 namespace ash { |
| 17 class FrameBorderHitTestController; | 19 class FrameBorderHitTestController; |
| 20 class FrameCaptionButton; |
| 18 class FrameCaptionButtonContainerView; | 21 class FrameCaptionButtonContainerView; |
| 19 class HeaderPainter; | 22 class HeaderPainter; |
| 20 } | 23 } |
| 21 namespace views { | 24 namespace views { |
| 22 class ImageButton; | 25 class ImageButton; |
| 23 class ToggleImageButton; | 26 class ToggleImageButton; |
| 24 } | 27 } |
| 25 | 28 |
| 26 class BrowserNonClientFrameViewAsh | 29 class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView, |
| 27 : public BrowserNonClientFrameView, | 30 public ash::ShellObserver, |
| 28 public ash::ShellObserver, | 31 public chrome::TabIconViewModel, |
| 29 public chrome::TabIconViewModel { | 32 public CommandObserver, |
| 33 public views::ButtonListener { |
| 30 public: | 34 public: |
| 31 static const char kViewClassName[]; | 35 static const char kViewClassName[]; |
| 32 | 36 |
| 33 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view); | 37 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view); |
| 34 virtual ~BrowserNonClientFrameViewAsh(); | 38 virtual ~BrowserNonClientFrameViewAsh(); |
| 35 | 39 |
| 36 void Init(); | 40 void Init(); |
| 37 | 41 |
| 38 // BrowserNonClientFrameView: | 42 // BrowserNonClientFrameView: |
| 39 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; | 43 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 65 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 62 | 66 |
| 63 // ash::ShellObserver: | 67 // ash::ShellObserver: |
| 64 virtual void OnMaximizeModeStarted() OVERRIDE; | 68 virtual void OnMaximizeModeStarted() OVERRIDE; |
| 65 virtual void OnMaximizeModeEnded() OVERRIDE; | 69 virtual void OnMaximizeModeEnded() OVERRIDE; |
| 66 | 70 |
| 67 // chrome::TabIconViewModel: | 71 // chrome::TabIconViewModel: |
| 68 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; | 72 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; |
| 69 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE; | 73 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE; |
| 70 | 74 |
| 75 // CommandObserver: |
| 76 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
| 77 |
| 78 // views::ButtonListener: |
| 79 virtual void ButtonPressed(views::Button* sender, |
| 80 const ui::Event& event) OVERRIDE; |
| 81 |
| 71 private: | 82 private: |
| 72 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader); | 83 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader); |
| 73 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, | 84 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, |
| 74 NonImmersiveFullscreen); | 85 NonImmersiveFullscreen); |
| 75 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, | 86 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, |
| 76 ImmersiveFullscreen); | 87 ImmersiveFullscreen); |
| 77 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, | 88 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, |
| 78 ToggleMaximizeModeRelayout); | 89 ToggleMaximizeModeRelayout); |
| 79 | 90 |
| 80 // views::NonClientFrameView: | 91 // views::NonClientFrameView: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 // Returns true if we should use a super short header with light bars instead | 102 // Returns true if we should use a super short header with light bars instead |
| 92 // of regular tabs. This header is used in immersive fullscreen when the | 103 // of regular tabs. This header is used in immersive fullscreen when the |
| 93 // top-of-window views are not revealed. | 104 // top-of-window views are not revealed. |
| 94 bool UseImmersiveLightbarHeaderStyle() const; | 105 bool UseImmersiveLightbarHeaderStyle() const; |
| 95 | 106 |
| 96 // Returns true if the header should be painted so that it looks the same as | 107 // Returns true if the header should be painted so that it looks the same as |
| 97 // the header used for packaged apps. Packaged apps use a different color | 108 // the header used for packaged apps. Packaged apps use a different color |
| 98 // scheme than browser windows. | 109 // scheme than browser windows. |
| 99 bool UsePackagedAppHeaderStyle() const; | 110 bool UsePackagedAppHeaderStyle() const; |
| 100 | 111 |
| 112 // Returns true if the header should be painted with a WebApp header style. |
| 113 // The WebApp header style has a back button and title along with the usual |
| 114 // accoutrements. |
| 115 bool UseWebAppHeaderStyle() const; |
| 116 |
| 101 // Layout the incognito icon. | 117 // Layout the incognito icon. |
| 102 void LayoutAvatar(); | 118 void LayoutAvatar(); |
| 103 | 119 |
| 104 // Returns true if there is anything to paint. Some fullscreen windows do not | 120 // Returns true if there is anything to paint. Some fullscreen windows do not |
| 105 // need their frames painted. | 121 // need their frames painted. |
| 106 bool ShouldPaint() const; | 122 bool ShouldPaint() const; |
| 107 | 123 |
| 108 // Paints the header background when the frame is in immersive fullscreen and | 124 // Paints the header background when the frame is in immersive fullscreen and |
| 109 // tab light bar is visible. | 125 // tab light bar is visible. |
| 110 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas); | 126 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas); |
| 111 | 127 |
| 112 void PaintToolbarBackground(gfx::Canvas* canvas); | 128 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 113 | 129 |
| 114 // Draws the line under the header for windows without a toolbar and not using | 130 // Draws the line under the header for windows without a toolbar and not using |
| 115 // the packaged app header style. | 131 // the packaged app header style. |
| 116 void PaintContentEdge(gfx::Canvas* canvas); | 132 void PaintContentEdge(gfx::Canvas* canvas); |
| 117 | 133 |
| 134 // Update the state of the back button. |
| 135 void UpdateBackButtonState(bool enabled); |
| 136 |
| 118 // View which contains the window controls. | 137 // View which contains the window controls. |
| 119 ash::FrameCaptionButtonContainerView* caption_button_container_; | 138 ash::FrameCaptionButtonContainerView* caption_button_container_; |
| 120 | 139 |
| 140 // The back button for web app style header. |
| 141 ash::FrameCaptionButton* web_app_back_button_; |
| 142 |
| 121 // For popups, the window icon. | 143 // For popups, the window icon. |
| 122 TabIconView* window_icon_; | 144 TabIconView* window_icon_; |
| 123 | 145 |
| 124 // Helper class for painting the header. | 146 // Helper class for painting the header. |
| 125 scoped_ptr<ash::HeaderPainter> header_painter_; | 147 scoped_ptr<ash::HeaderPainter> header_painter_; |
| 126 | 148 |
| 127 // Updates the hittest bounds overrides based on the window show type. | 149 // Updates the hittest bounds overrides based on the window show type. |
| 128 scoped_ptr<ash::FrameBorderHitTestController> | 150 scoped_ptr<ash::FrameBorderHitTestController> |
| 129 frame_border_hit_test_controller_; | 151 frame_border_hit_test_controller_; |
| 130 | 152 |
| 131 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh); | 153 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh); |
| 132 }; | 154 }; |
| 133 | 155 |
| 134 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ | 156 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| OLD | NEW |