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

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

Issue 2910773002: cros: CustomFrameViewAsh avatar icon from a window prop (Closed)
Patch Set: rebase Created 3 years, 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ 5 #ifndef ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_
6 #define ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ 6 #define ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 // Internal class name. 36 // Internal class name.
37 static const char kViewClassName[]; 37 static const char kViewClassName[];
38 38
39 // |enable_immersive| controls whether ImmersiveFullscreenController is 39 // |enable_immersive| controls whether ImmersiveFullscreenController is
40 // created for the CustomFrameViewAsh; if true and a WindowStateDelegate has 40 // created for the CustomFrameViewAsh; if true and a WindowStateDelegate has
41 // not been set on the WindowState associated with |frame|, then an 41 // not been set on the WindowState associated with |frame|, then an
42 // ImmersiveFullscreenController is created. 42 // ImmersiveFullscreenController is created.
43 // If ImmersiveFullscreenControllerDelegate is not supplied, HeaderView is 43 // If ImmersiveFullscreenControllerDelegate is not supplied, HeaderView is
44 // used as the ImmersiveFullscreenControllerDelegate. 44 // used as the ImmersiveFullscreenControllerDelegate.
45 explicit CustomFrameViewAsh( 45 CustomFrameViewAsh(
James Cook 2017/05/30 21:27:15 nit: I think we still want "explicit" here, since
xiyuan 2017/05/30 22:44:14 I see. Restored "explicit".
46 views::Widget* frame, 46 views::Widget* frame,
47 ImmersiveFullscreenControllerDelegate* immersive_delegate = nullptr, 47 ImmersiveFullscreenControllerDelegate* immersive_delegate = nullptr,
48 bool enable_immersive = true, 48 bool enable_immersive = true,
49 mojom::WindowStyle window_style = mojom::WindowStyle::DEFAULT); 49 mojom::WindowStyle window_style = mojom::WindowStyle::DEFAULT);
50 ~CustomFrameViewAsh() override; 50 ~CustomFrameViewAsh() override;
51 51
52 // Inits |immersive_fullscreen_controller| so that the controller reveals 52 // Inits |immersive_fullscreen_controller| so that the controller reveals
53 // and hides |header_view_| in immersive fullscreen. 53 // and hides |header_view_| in immersive fullscreen.
54 // CustomFrameViewAsh does not take ownership of 54 // CustomFrameViewAsh does not take ownership of
55 // |immersive_fullscreen_controller|. 55 // |immersive_fullscreen_controller|.
56 void InitImmersiveFullscreenControllerForView( 56 void InitImmersiveFullscreenControllerForView(
57 ImmersiveFullscreenController* immersive_fullscreen_controller); 57 ImmersiveFullscreenController* immersive_fullscreen_controller);
58 58
59 // Sets the active and inactive frame colors. Note the inactive frame color 59 // Sets the active and inactive frame colors. Note the inactive frame color
60 // will have some transparency added when the frame is drawn. 60 // will have some transparency added when the frame is drawn.
61 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); 61 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
62 62
63 // Sets the height of the header. If |height| has no value (the default), the 63 // Sets the height of the header. If |height| has no value (the default), the
64 // preferred height is used. 64 // preferred height is used.
65 void SetHeaderHeight(base::Optional<int> height); 65 void SetHeaderHeight(base::Optional<int> height);
66 66
67 views::View* header_view(); 67 // Get the view of the header.
68 views::View* GetHeaderView();
68 69
69 // views::NonClientFrameView: 70 // views::NonClientFrameView:
70 gfx::Rect GetBoundsForClientView() const override; 71 gfx::Rect GetBoundsForClientView() const override;
71 gfx::Rect GetWindowBoundsForClientBounds( 72 gfx::Rect GetWindowBoundsForClientBounds(
72 const gfx::Rect& client_bounds) const override; 73 const gfx::Rect& client_bounds) const override;
73 int NonClientHitTest(const gfx::Point& point) override; 74 int NonClientHitTest(const gfx::Point& point) override;
74 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; 75 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
75 void ResetWindowControls() override; 76 void ResetWindowControls() override;
76 void UpdateWindowIcon() override; 77 void UpdateWindowIcon() override;
77 void UpdateWindowTitle() override; 78 void UpdateWindowTitle() override;
78 void SizeConstraintsChanged() override; 79 void SizeConstraintsChanged() override;
79 void ActivationChanged(bool active) override; 80 void ActivationChanged(bool active) override;
80 81
81 // views::View: 82 // views::View:
82 gfx::Size CalculatePreferredSize() const override; 83 gfx::Size CalculatePreferredSize() const override;
83 void Layout() override; 84 void Layout() override;
84 const char* GetClassName() const override; 85 const char* GetClassName() const override;
85 gfx::Size GetMinimumSize() const override; 86 gfx::Size GetMinimumSize() const override;
86 gfx::Size GetMaximumSize() const override; 87 gfx::Size GetMaximumSize() const override;
87 void SchedulePaintInRect(const gfx::Rect& r) override; 88 void SchedulePaintInRect(const gfx::Rect& r) override;
88 void VisibilityChanged(views::View* starting_from, bool is_visible) override;
89
90 // Get the view of the header.
91 views::View* GetHeaderView();
92 89
93 const views::View* GetAvatarIconViewForTest() const; 90 const views::View* GetAvatarIconViewForTest() const;
94 91
95 private: 92 private:
93 class AvatarObserver;
96 class OverlayView; 94 class OverlayView;
97 friend class TestWidgetConstraintsDelegate; 95 friend class TestWidgetConstraintsDelegate;
98 friend class CustomFrameViewAshSizeLock; 96 friend class CustomFrameViewAshSizeLock;
99 97
100 // views::NonClientFrameView: 98 // views::NonClientFrameView:
101 bool DoesIntersectRect(const views::View* target, 99 bool DoesIntersectRect(const views::View* target,
102 const gfx::Rect& rect) const override; 100 const gfx::Rect& rect) const override;
103 101
104 // Returns the container for the minimize/maximize/close buttons that is held 102 // Returns the container for the minimize/maximize/close buttons that is held
105 // by the HeaderView. Used in testing. 103 // by the HeaderView. Used in testing.
106 FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest(); 104 FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest();
107 105
108 // Height from top of window to top of client area. 106 // Height from top of window to top of client area.
109 int NonClientTopBorderHeight() const; 107 int NonClientTopBorderHeight() const;
110 108
111 // Not owned. 109 // Not owned.
112 views::Widget* frame_; 110 views::Widget* frame_;
113 111
114 // View which contains the title and window controls. 112 // View which contains the title and window controls.
115 HeaderView* header_view_; 113 HeaderView* header_view_;
116 114
117 OverlayView* overlay_view_; 115 OverlayView* overlay_view_;
118 116
119 ImmersiveFullscreenControllerDelegate* immersive_delegate_; 117 ImmersiveFullscreenControllerDelegate* immersive_delegate_;
120 118
119 // Observes avatar icon change and updates |header_view_|.
120 std::unique_ptr<AvatarObserver> avatar_observer_;
121
121 static bool use_empty_minimum_size_for_test_; 122 static bool use_empty_minimum_size_for_test_;
122 123
123 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh); 124 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh);
124 }; 125 };
125 126
126 } // namespace ash 127 } // namespace ash
127 128
128 #endif // ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ 129 #endif // ASH_FRAME_CUSTOM_FRAME_VIEW_ASH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698