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

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

Issue 2215223003: Moves most frame related classes to ash/common/frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 4 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
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_FRAME_DEFAULT_HEADER_PAINTER_H_
6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "ash/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 ImageSkia;
20 class Rect;
21 class SlideAnimation;
22 }
23 namespace views {
24 class View;
25 class Widget;
26 }
27
28 namespace ash {
29 class FrameCaptionButtonContainerView;
30
31 // Helper class for painting the default window header.
32 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
33 public gfx::AnimationDelegate {
34 public:
35 DefaultHeaderPainter();
36 ~DefaultHeaderPainter() override;
37
38 // DefaultHeaderPainter does not take ownership of any of the parameters.
39 void Init(views::Widget* frame,
40 views::View* header_view,
41 FrameCaptionButtonContainerView* caption_button_container);
42
43 // HeaderPainter overrides:
44 int GetMinimumHeaderWidth() const override;
45 void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
46 void LayoutHeader() override;
47 int GetHeaderHeight() const override;
48 int GetHeaderHeightForPainting() const override;
49 void SetHeaderHeightForPainting(int height) override;
50 void SchedulePaintForTitle() override;
51
52 // Sets the left header view for the header. Passing NULL removes the view.
53 void UpdateLeftHeaderView(views::View* left_header_view);
54
55 // Sets the active and inactive frame colors. Note the inactive frame color
56 // will have some transparency added when the frame is drawn.
57 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
58
59 private:
60 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
61 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, LightIcons);
62
63 // gfx::AnimationDelegate override:
64 void AnimationProgressed(const gfx::Animation* animation) override;
65
66 // Paints highlight around the edge of the header for inactive restored
67 // windows.
68 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
69
70 // Paints the title bar, primarily the title string.
71 void PaintTitleBar(gfx::Canvas* canvas);
72
73 // Paints the header/content separator.
74 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
75
76 // Whether light caption images should be used. This is the case when the
77 // background of the frame is dark.
78 bool ShouldUseLightImages();
79
80 // Update all the images in the caption buttons.
81 void UpdateAllButtonImages();
82
83 // Updates the size button's images.
84 void UpdateSizeButtonImages();
85
86 // Returns the header bounds in the coordinates of |view_|. The header is
87 // assumed to be positioned at the top left corner of |view_| and to have the
88 // same width as |view_|.
89 gfx::Rect GetLocalBounds() const;
90
91 // Returns the bounds for the title.
92 gfx::Rect GetTitleBounds() const;
93
94 // Returns whether the frame uses custom frame coloring.
95 bool UsesCustomFrameColors() const;
96
97 views::Widget* frame_;
98 views::View* view_;
99 views::View* left_header_view_; // May be NULL.
100 SkColor active_frame_color_;
101 SkColor inactive_frame_color_;
102 FrameCaptionButtonContainerView* caption_button_container_;
103
104 // The height of the header to paint.
105 int painted_height_;
106
107 // Whether the header should be painted as active.
108 Mode mode_;
109
110 // Whether the header is painted for the first time.
111 bool initial_paint_;
112
113 std::unique_ptr<gfx::SlideAnimation> activation_animation_;
114
115 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
116 };
117
118 } // namespace ash
119
120 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
OLDNEW
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698