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_DETACHABLE_TOOLBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/views/accessible_pane_view.h" | 9 #include "ui/views/accessible_pane_view.h" |
10 | 10 |
| 11 namespace gfx { |
| 12 class ImageSkia; |
| 13 } |
| 14 |
11 struct SkRect; | 15 struct SkRect; |
12 | 16 |
13 // DetachableToolbarView contains functionality common to views that can detach | 17 // DetachableToolbarView contains functionality common to views that can detach |
14 // from the Chrome frame, such as the BookmarkBarView and the Extension shelf. | 18 // from the Chrome frame, such as the BookmarkBarView and the Extension shelf. |
15 class DetachableToolbarView : public views::AccessiblePaneView { | 19 class DetachableToolbarView : public views::AccessiblePaneView { |
16 public: | 20 public: |
17 // The color gradient start value close to the edge of the divider. | 21 // The color gradient start value close to the edge of the divider. |
18 static const SkColor kEdgeDividerColor; | 22 static const SkColor kEdgeDividerColor; |
19 // The color gradient value for the middle of the divider. | 23 // The color gradient value for the middle of the divider. |
20 static const SkColor kMiddleDividerColor; | 24 static const SkColor kMiddleDividerColor; |
21 | 25 |
22 DetachableToolbarView() {} | 26 DetachableToolbarView() {} |
23 virtual ~DetachableToolbarView() {} | 27 virtual ~DetachableToolbarView() {} |
24 | 28 |
25 // Whether the view is currently detached from the Chrome frame. | 29 // Whether the view is currently detached from the Chrome frame. |
26 virtual bool IsDetached() const = 0; | 30 virtual bool IsDetached() const = 0; |
27 | 31 |
28 // Gets the current state of the resize animation (show/hide). | 32 // Gets the current state of the resize animation (show/hide). |
29 virtual double GetAnimationValue() const = 0; | 33 virtual double GetAnimationValue() const = 0; |
30 | 34 |
31 // Gets the current amount of overlap atop the browser toolbar. | 35 // Gets the current amount of overlap atop the browser toolbar. |
32 virtual int GetToolbarOverlap() const = 0; | 36 virtual int GetToolbarOverlap() const = 0; |
33 | 37 |
34 // Paints the background (including the theme image behind content area) when | 38 // Paints the background (including the theme image behind content area) when |
35 // the bar/shelf is attached to the top toolbar. |background_origin| is the | 39 // the bar/shelf is attached to the top toolbar. |background_origin| is the |
36 // origin to use for painting the theme image. | 40 // origin to use for painting the theme image. |
37 static void PaintBackgroundAttachedMode(gfx::Canvas* canvas, | 41 static void PaintBackgroundAttachedMode( |
38 views::View* view, | 42 gfx::Canvas* canvas, |
39 const gfx::Point& background_origin); | 43 views::View* view, |
| 44 const gfx::Point& background_origin, |
| 45 SkColor toolbar_background_color, |
| 46 gfx::ImageSkia* toolbar_background_image); |
40 | 47 |
41 // Calculate the rect for the content area of the bar/shelf. This is only | 48 // Calculate the rect for the content area of the bar/shelf. This is only |
42 // needed when the bar/shelf is detached from the Chrome frame (otherwise the | 49 // needed when the bar/shelf is detached from the Chrome frame (otherwise the |
43 // content area is the whole area of the bar/shelf. When detached, however, | 50 // content area is the whole area of the bar/shelf. When detached, however, |
44 // only a small round rectangle is for drawing our content on. This calculates | 51 // only a small round rectangle is for drawing our content on. This calculates |
45 // how big this area is, where it is located within the shelf and how round | 52 // how big this area is, where it is located within the shelf and how round |
46 // the edges should be. | 53 // the edges should be. |
47 static void CalculateContentArea(double animation_state, | 54 static void CalculateContentArea(double animation_state, |
48 double horizontal_padding, | 55 double horizontal_padding, |
49 double vertical_padding, | 56 double vertical_padding, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int vertical_padding, | 88 int vertical_padding, |
82 SkColor top_color, | 89 SkColor top_color, |
83 SkColor middle_color, | 90 SkColor middle_color, |
84 SkColor bottom_color); | 91 SkColor bottom_color); |
85 | 92 |
86 private: | 93 private: |
87 DISALLOW_COPY_AND_ASSIGN(DetachableToolbarView); | 94 DISALLOW_COPY_AND_ASSIGN(DetachableToolbarView); |
88 }; | 95 }; |
89 | 96 |
90 #endif // CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
OLD | NEW |