| 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_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 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/ui/search/toolbar_search_animator_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.h" | 13 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 13 #include "ui/views/controls/button/button.h" // ButtonListener | 14 #include "ui/views/controls/button/button.h" // ButtonListener |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 class FramePainter; | 17 class FramePainter; |
| 17 } | 18 } |
| 18 namespace views { | 19 namespace views { |
| 19 class ImageButton; | 20 class ImageButton; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView, | 23 class BrowserNonClientFrameViewAsh |
| 23 public views::ButtonListener, | 24 : public BrowserNonClientFrameView, |
| 24 public TabIconView::TabIconViewModel { | 25 public views::ButtonListener, |
| 26 public TabIconView::TabIconViewModel, |
| 27 public chrome::search::ToolbarSearchAnimatorObserver { |
| 25 public: | 28 public: |
| 26 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
| 27 | 30 |
| 28 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view); | 31 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view); |
| 29 virtual ~BrowserNonClientFrameViewAsh(); | 32 virtual ~BrowserNonClientFrameViewAsh(); |
| 30 | 33 |
| 31 void Init(); | 34 void Init(); |
| 32 | 35 |
| 33 // BrowserNonClientFrameView overrides: | 36 // BrowserNonClientFrameView overrides: |
| 34 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; | 37 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 virtual gfx::Size GetMinimumSize() OVERRIDE; | 58 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 56 | 59 |
| 57 // views::ButtonListener overrides: | 60 // views::ButtonListener overrides: |
| 58 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
| 59 const views::Event& event) OVERRIDE; | 62 const views::Event& event) OVERRIDE; |
| 60 | 63 |
| 61 // Overridden from TabIconView::TabIconViewModel: | 64 // Overridden from TabIconView::TabIconViewModel: |
| 62 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; | 65 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; |
| 63 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE; | 66 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE; |
| 64 | 67 |
| 68 // Overridden from chrome::search::ToolbarSearchAnimatorObserver: |
| 69 virtual void BackgroundChanging() OVERRIDE; |
| 70 virtual void BackgroundChanged() OVERRIDE; |
| 71 virtual void BackgroundChangeCanceled(TabContents* tab_contents) OVERRIDE; |
| 72 |
| 65 private: | 73 private: |
| 66 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, UseShortHeader); | 74 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, UseShortHeader); |
| 67 | 75 |
| 68 // Distance between top of window and client area. | 76 // Distance between top of window and client area. |
| 69 int NonClientTopBorderHeight(bool force_restored) const; | 77 int NonClientTopBorderHeight(bool force_restored) const; |
| 70 | 78 |
| 71 // Returns true if we should use a short header, such as for popup windows. | 79 // Returns true if we should use a short header, such as for popup windows. |
| 72 bool UseShortHeader() const; | 80 bool UseShortHeader() const; |
| 73 | 81 |
| 74 // Layout the incognito icon. | 82 // Layout the incognito icon. |
| 75 void LayoutAvatar(); | 83 void LayoutAvatar(); |
| 76 | 84 |
| 77 void PaintTitleBar(gfx::Canvas* canvas); | 85 void PaintTitleBar(gfx::Canvas* canvas); |
| 78 void PaintToolbarBackground(gfx::Canvas* canvas); | 86 void PaintToolbarBackground(gfx::Canvas* canvas, |
| 87 chrome::search::Mode::Type mode); |
| 79 | 88 |
| 80 // Windows without a toolbar need to draw their own line under the header, | 89 // Windows without a toolbar need to draw their own line under the header, |
| 81 // above the content area. | 90 // above the content area. |
| 82 void PaintContentEdge(gfx::Canvas* canvas); | 91 void PaintContentEdge(gfx::Canvas* canvas); |
| 83 | 92 |
| 84 // Returns the correct image id for the frame header based on activation | 93 // Returns the correct image id for the frame header based on activation |
| 85 // state and incognito mode. | 94 // state and incognito mode. |
| 86 int GetThemeFrameImageId() const; | 95 int GetThemeFrameImageId() const; |
| 87 const gfx::ImageSkia* GetThemeFrameOverlayImage() const; | 96 const gfx::ImageSkia* GetThemeFrameOverlayImage() const; |
| 88 | 97 |
| 89 // Window controls. The |size_button_| either toggles maximized or toggles | 98 // Window controls. The |size_button_| either toggles maximized or toggles |
| 90 // minimized. The exact behavior is determined by |size_button_minimizes_|. | 99 // minimized. The exact behavior is determined by |size_button_minimizes_|. |
| 91 views::ImageButton* size_button_; | 100 views::ImageButton* size_button_; |
| 92 views::ImageButton* close_button_; | 101 views::ImageButton* close_button_; |
| 93 | 102 |
| 94 // For popups, the window icon. | 103 // For popups, the window icon. |
| 95 TabIconView* window_icon_; | 104 TabIconView* window_icon_; |
| 96 | 105 |
| 97 // Painter for the frame header. | 106 // Painter for the frame header. |
| 98 scoped_ptr<ash::FramePainter> frame_painter_; | 107 scoped_ptr<ash::FramePainter> frame_painter_; |
| 99 | 108 |
| 100 // If true the |size_button_| minimizes, otherwise it toggles between | 109 // If true the |size_button_| minimizes, otherwise it toggles between |
| 101 // maximized and restored. | 110 // maximized and restored. |
| 102 bool size_button_minimizes_; | 111 bool size_button_minimizes_; |
| 103 | 112 |
| 104 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh); | 113 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh); |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ | 116 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ |
| OLD | NEW |