OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
| 7 |
| 8 #include "views/view.h" |
| 9 |
| 10 class SkBitmap; |
| 11 struct SkRect; |
| 12 |
| 13 // DetachableToolbarView contains functionality common to views that can detach |
| 14 // from the Chrome frame, such as the BookmarkBarView and the Extension shelf. |
| 15 class DetachableToolbarView : public views::View { |
| 16 public: |
| 17 DetachableToolbarView() {} |
| 18 virtual ~DetachableToolbarView() {} |
| 19 |
| 20 // Whether the view is currently detached from the Chrome frame. |
| 21 virtual bool IsDetached() const = 0; |
| 22 |
| 23 // Whether the shelf/bar is above the page or below it. |
| 24 virtual bool IsOnTop() const = 0; |
| 25 |
| 26 // Gets the current state of the resize animation (show/hide). |
| 27 virtual double GetAnimationValue() const = 0; |
| 28 |
| 29 // Paint the background (including the theme image behind content area) when |
| 30 // in bar/shelf is detached from the Chrome frame. |
| 31 static void PaintBackgroundDetachedMode(gfx::Canvas* canvas, |
| 32 views::View* view); |
| 33 |
| 34 // Paint the background (including the theme image behind content area) when |
| 35 // in bar/shelf is attached to the Chrome frame. |
| 36 static void PaintBackgroundAttachedMode(gfx::Canvas* canvas, |
| 37 views::View* view); |
| 38 |
| 39 // Calculate the rect for the content area of the bar/shelf. This is only |
| 40 // needed when the bar/shelf is detached from the Chrome frame (otherwise the |
| 41 // content area is the whole area of the bar/shelf. When detached, however, |
| 42 // only a small round rectangle is for drawing our content on. This calculates |
| 43 // how big this area is, where it is located within the shelf and how round |
| 44 // the edges should be. |
| 45 static void CalculateContentArea(double animation_state, |
| 46 double horizontal_padding, |
| 47 double vertical_padding, |
| 48 SkRect* rect, |
| 49 double* roundness, |
| 50 views::View* view); |
| 51 |
| 52 // Paint the horizontal border separating the shelf/bar from the page content. |
| 53 static void PaintHorizontalBorder(gfx::Canvas* canvas, |
| 54 DetachableToolbarView* view); |
| 55 |
| 56 // Paint the background of the content area (the surface behind the |
| 57 // bookmarks or extension toolstrips). |rect| is the rectangle to paint |
| 58 // the background within. |roundness| describes the roundness of the corners. |
| 59 static void PaintContentAreaBackground(gfx::Canvas* canvas, |
| 60 ThemeProvider* theme_provider, |
| 61 const SkRect& rect, |
| 62 double roundness); |
| 63 // Paint the border around the content area (when in detached mode). |
| 64 static void PaintContentAreaBorder(gfx::Canvas* canvas, |
| 65 ThemeProvider* theme_provider, |
| 66 const SkRect& rect, |
| 67 double roundness); |
| 68 |
| 69 // Paint a themed gradient divider at location |x|. The color of the divider |
| 70 // is a gradient starting with |top_color| at the top, and changing into |
| 71 // |middle_color| and then over to |bottom_color| as you go further down. |
| 72 static void PaintVerticalDivider(gfx::Canvas* canvas, |
| 73 int x, |
| 74 int height, |
| 75 int vertical_padding, |
| 76 const SkColor& top_color, |
| 77 const SkColor& middle_color, |
| 78 const SkColor& bottom_color); |
| 79 |
| 80 // Paint the theme background with the proper alignment. |
| 81 static void PaintThemeBackgroundTopAligned(gfx::Canvas* canvas, |
| 82 SkBitmap* ntp_background, |
| 83 int tiling, |
| 84 int alignment, |
| 85 int width, |
| 86 int height); |
| 87 static void PaintThemeBackgroundBottomAligned(gfx::Canvas* canvas, |
| 88 SkBitmap* ntp_background, |
| 89 int tiling, |
| 90 int alignment, |
| 91 int width, |
| 92 int height, |
| 93 int browser_height); |
| 94 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(DetachableToolbarView); |
| 96 }; |
| 97 |
| 98 #endif // CHROME_BROWSER_VIEWS_DETACHABLE_TOOLBAR_VIEW_H_ |
OLD | NEW |