1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_
8 #include "ash/frame/header_painter.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" // OVERRIDE
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/animation/animation_delegate.h"
17 class FrameCaptionButtonContainerView;
30 // Helper class for painting the browser window header.
31 class BrowserHeaderPainterAsh : public ash::HeaderPainter,
32 public gfx::AnimationDelegate {
34 BrowserHeaderPainterAsh();
35 virtual ~BrowserHeaderPainterAsh();
37 // BrowserHeaderPainterAsh does not take ownership of any of the parameters.
40 BrowserView* browser_view,
41 views::View* header_view,
42 views::View* window_icon,
43 ash::FrameCaptionButtonContainerView* caption_button_container);
45 // ash::HeaderPainter overrides:
46 virtual int GetMinimumHeaderWidth() const OVERRIDE;
47 virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE;
48 virtual void LayoutHeader() OVERRIDE;
49 virtual int GetHeaderHeightForPainting() const OVERRIDE;
50 virtual void SetHeaderHeightForPainting(int height) OVERRIDE;
51 virtual void SchedulePaintForTitle() OVERRIDE;
52 virtual void UpdateLeftViewXInset(int left_view_x_inset) OVERRIDE;
55 // gfx::AnimationDelegate override:
56 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
58 // Paints highlight around the edge of the header for restored windows.
59 void PaintHighlightForRestoredWindow(gfx::Canvas* canvas);
61 // Paints the title bar, primarily the title string.
62 void PaintTitleBar(gfx::Canvas* canvas);
64 // Sets |frame_image| and |frame_overlay_image| to the frame image and the
65 // frame overlay image respectivately which should be used to paint the
67 void GetFrameImages(Mode mode,
68 gfx::ImageSkia* frame_image,
69 gfx::ImageSkia* frame_overlay_image) const;
71 // Sets |frame_image| and |frame_overlay_image| to the frame image and the
72 // frame overlay image respectively that should be used to paint the header
73 // for tabbed browser windows.
74 void GetFrameImagesForTabbedBrowser(
76 gfx::ImageSkia* frame_image,
77 gfx::ImageSkia* frame_overlay_image) const;
79 // Returns the frame image which should be used to paint the header for popup
80 // browser windows and for hosted app windows which show the toolbar.
81 gfx::ImageSkia GetFrameImageForNonTabbedBrowser(Mode mode) const;
83 // Updates the images used for the minimize, restore and close buttons.
84 void UpdateCaptionButtonImages();
86 // Returns bounds of the region in |view_| which is painted with the header
87 // images. The region is assumed to start at the top left corner of |view_|
88 // and to have the same width as |view_|.
89 gfx::Rect GetPaintedBounds() const;
91 // Returns the bounds for the title.
92 gfx::Rect GetTitleBounds() const;
94 views::Widget* frame_;
96 // Whether the header is for a tabbed browser window.
99 // Whether the header is for an incognito browser window.
105 views::View* window_icon_;
106 int window_icon_x_inset_;
107 ash::FrameCaptionButtonContainerView* caption_button_container_;
110 // Whether the header is painted for the first time.
113 // Whether the header should be painted as active.
116 scoped_ptr<gfx::SlideAnimation> activation_animation_;
118 DISALLOW_COPY_AND_ASSIGN(BrowserHeaderPainterAsh);
121 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_