Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: ash/common/frame/default_header_painter.h

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_
6 #define ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "ash/common/frame/header_painter.h"
12 #include "base/compiler_specific.h" // override
13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h"
15 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/gfx/animation/animation_delegate.h"
17
18 namespace gfx {
19 class Rect;
20 class SlideAnimation;
21 }
22 namespace views {
23 class View;
24 class Widget;
25 }
26
27 namespace ash {
28 class FrameCaptionButtonContainerView;
29
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 ~DefaultHeaderPainter() override;
36
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);
41
42 // HeaderPainter overrides:
43 int GetMinimumHeaderWidth() const override;
44 void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
45 void LayoutHeader() override;
46 int GetHeaderHeight() const override;
47 int GetHeaderHeightForPainting() const override;
48 void SetHeaderHeightForPainting(int height) override;
49 void SchedulePaintForTitle() override;
50
51 // Sets the left header view for the header. Passing NULL removes the view.
52 void UpdateLeftHeaderView(views::View* left_header_view);
53
54 // Sets the active and inactive frame colors. Note the inactive frame color
55 // will have some transparency added when the frame is drawn.
56 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
57 SkColor GetActiveFrameColor() const;
58 SkColor GetInactiveFrameColor() const;
59
60 private:
61 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
62 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, LightIcons);
63
64 // gfx::AnimationDelegate override:
65 void AnimationProgressed(const gfx::Animation* animation) override;
66
67 // Paints highlight around the edge of the header for inactive restored
68 // windows.
69 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
70
71 // Paints the title bar, primarily the title string.
72 void PaintTitleBar(gfx::Canvas* canvas);
73
74 // Paints the header/content separator.
75 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
76
77 // Whether light caption images should be used. This is the case when the
78 // background of the frame is dark.
79 bool ShouldUseLightImages();
80
81 // Update all the images in the caption buttons.
82 void UpdateAllButtonImages();
83
84 // Updates the size button's images.
85 void UpdateSizeButtonImages();
86
87 // Returns the header bounds in the coordinates of |view_|. The header is
88 // assumed to be positioned at the top left corner of |view_| and to have the
89 // same width as |view_|.
90 gfx::Rect GetLocalBounds() const;
91
92 // Returns the bounds for the title.
93 gfx::Rect GetTitleBounds() const;
94
95 // Returns whether the frame uses custom frame coloring.
96 bool UsesCustomFrameColors() const;
97
98 views::Widget* frame_;
99 views::View* view_;
100 views::View* left_header_view_; // May be NULL.
101 SkColor active_frame_color_;
102 SkColor inactive_frame_color_;
103 FrameCaptionButtonContainerView* caption_button_container_;
104
105 // The height of the header to paint.
106 int painted_height_;
107
108 // Whether the header should be painted as active.
109 Mode mode_;
110
111 // Whether the header is painted for the first time.
112 bool initial_paint_;
113
114 std::unique_ptr<gfx::SlideAnimation> activation_animation_;
115
116 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
117 };
118
119 } // namespace ash
120
121 #endif // ASH_COMMON_FRAME_DEFAULT_HEADER_PAINTER_H_
OLDNEW
« no previous file with comments | « ash/common/frame/custom_frame_view_ash_unittest.cc ('k') | ash/common/frame/default_header_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698