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