Add chrome.usb.getConfiguration and expose extra descriptors.
[chromium-blink-merge.git] / ash / frame / default_header_painter.h
blobc0ca2fdafd73920fbf16af3f571cd489e0c88f54
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 ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
8 #include "ash/ash_export.h"
9 #include "ash/frame/header_painter.h"
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" // OVERRIDE
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/gfx/animation/animation_delegate.h"
17 namespace gfx {
18 class ImageSkia;
19 class Rect;
20 class SlideAnimation;
22 namespace views {
23 class View;
24 class Widget;
27 namespace ash {
28 class FrameCaptionButtonContainerView;
30 // Helper class for painting the default window header.
31 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
32 public gfx::AnimationDelegate {
33 public:
34 DefaultHeaderPainter();
35 virtual ~DefaultHeaderPainter();
37 // DefaultHeaderPainter does not take ownership of any of the parameters.
38 void Init(views::Widget* frame,
39 views::View* header_view,
40 FrameCaptionButtonContainerView* caption_button_container);
42 // HeaderPainter overrides:
43 virtual int GetMinimumHeaderWidth() const OVERRIDE;
44 virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE;
45 virtual void LayoutHeader() OVERRIDE;
46 virtual int GetHeaderHeightForPainting() const OVERRIDE;
47 virtual void SetHeaderHeightForPainting(int height) OVERRIDE;
48 virtual void SchedulePaintForTitle() OVERRIDE;
49 virtual void UpdateLeftViewXInset(int left_view_x_inset) OVERRIDE;
51 // Sets the left header view for the header. Passing NULL removes the view.
52 void UpdateLeftHeaderView(views::View* left_header_view);
54 private:
55 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
57 // gfx::AnimationDelegate override:
58 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
60 // Paints highlight around the edge of the header for inactive restored
61 // windows.
62 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
64 // Paints the title bar, primarily the title string.
65 void PaintTitleBar(gfx::Canvas* canvas);
67 // Paints the header/content separator.
68 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
70 // Layout the left header view.
71 void LayoutLeftHeaderView();
73 // Updates the size button's images.
74 void UpdateSizeButtonImages();
76 // Returns the header bounds in the coordinates of |view_|. The header is
77 // assumed to be positioned at the top left corner of |view_| and to have the
78 // same width as |view_|.
79 gfx::Rect GetLocalBounds() const;
81 // Returns the bounds for the title.
82 gfx::Rect GetTitleBounds() const;
84 // Returns the frame color to use when |frame_| is inactive.
85 SkColor GetInactiveFrameColor() const;
87 views::Widget* frame_;
88 views::View* view_;
89 views::View* left_header_view_; // May be NULL.
90 int left_view_x_inset_;
91 FrameCaptionButtonContainerView* caption_button_container_;
93 // The height of the header including the header/content separator.
94 int height_;
96 // Whether the header should be painted as active.
97 Mode mode_;
99 // Whether the header is painted for the first time.
100 bool initial_paint_;
102 scoped_ptr<gfx::SlideAnimation> activation_animation_;
104 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
107 } // namespace ash
109 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_