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