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

Side by Side Diff: ui/views/window/non_client_view.h

Issue 99553008: Fix regression where the active window header was not used for apps on CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/widget.cc ('k') | ui/views/window/non_client_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ 5 #ifndef UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_
6 #define UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ 6 #define UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_
7 7
8 #include "ui/views/view.h" 8 #include "ui/views/view.h"
9 9
10 namespace gfx { 10 namespace gfx {
(...skipping 19 matching lines...) Expand all
30 enum { 30 enum {
31 // Various edges of the frame border have a 1 px shadow along their edges; 31 // Various edges of the frame border have a 1 px shadow along their edges;
32 // in a few cases we shift elements based on this amount for visual appeal. 32 // in a few cases we shift elements based on this amount for visual appeal.
33 kFrameShadowThickness = 1, 33 kFrameShadowThickness = 1,
34 34
35 // In restored mode, we draw a 1 px edge around the content area inside the 35 // In restored mode, we draw a 1 px edge around the content area inside the
36 // frame border. 36 // frame border.
37 kClientEdgeThickness = 1, 37 kClientEdgeThickness = 1,
38 }; 38 };
39 39
40 virtual ~NonClientFrameView();
41
40 // Sets whether the window should be rendered as active regardless of the 42 // Sets whether the window should be rendered as active regardless of the
41 // actual active state. Used when bubbles become active to make their parent 43 // actual active state. Used when bubbles become active to make their parent
42 // appear active. A value of true makes the window render as active always, 44 // appear active. A value of true makes the window render as active always,
43 // false gives normal behavior. 45 // false gives normal behavior.
44 void SetInactiveRenderingDisabled(bool disable); 46 void SetInactiveRenderingDisabled(bool disable);
45 47
48 // Used to determine if the frame should be painted as active. Keyed off the
49 // window's actual active state and |inactive_rendering_disabled_|.
50 bool ShouldPaintAsActive() const;
51
46 // Helper for non-client view implementations to determine which area of the 52 // Helper for non-client view implementations to determine which area of the
47 // window border the specified |point| falls within. The other parameters are 53 // window border the specified |point| falls within. The other parameters are
48 // the size of the sizing edges, and whether or not the window can be 54 // the size of the sizing edges, and whether or not the window can be
49 // resized. 55 // resized.
50 int GetHTComponentForFrame(const gfx::Point& point, 56 int GetHTComponentForFrame(const gfx::Point& point,
51 int top_resize_border_height, 57 int top_resize_border_height,
52 int resize_border_thickness, 58 int resize_border_thickness,
53 int top_resize_corner_height, 59 int top_resize_corner_height,
54 int resize_corner_width, 60 int resize_corner_width,
55 bool can_resize); 61 bool can_resize);
(...skipping 17 matching lines...) Expand all
73 virtual void UpdateWindowTitle() = 0; 79 virtual void UpdateWindowTitle() = 0;
74 80
75 // Overridden from View: 81 // Overridden from View:
76 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; 82 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
77 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 83 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
78 virtual const char* GetClassName() const OVERRIDE; 84 virtual const char* GetClassName() const OVERRIDE;
79 85
80 protected: 86 protected:
81 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 87 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
82 88
83 NonClientFrameView() : paint_as_active_(false) {} 89 NonClientFrameView();
84
85 // Used to determine if the frame should be painted as active. Keyed off the
86 // window's actual active state and the override, see
87 // SetInactiveRenderingDisabled() above.
88 bool ShouldPaintAsActive() const;
89
90 // Invoked from SetInactiveRenderingDisabled(). This implementation invokes
91 // SchedulesPaint as necessary.
92 virtual void ShouldPaintAsActiveChanged();
93 90
94 private: 91 private:
95 // True when the non-client view should always be rendered as if the window 92 // Prevents the non-client frame view from being rendered as inactive when
96 // were active, regardless of whether or not the top level window actually 93 // true.
97 // is active. 94 bool inactive_rendering_disabled_;
98 bool paint_as_active_;
99 }; 95 };
100 96
101 //////////////////////////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////////////////////////
102 // NonClientView 98 // NonClientView
103 // 99 //
104 // The NonClientView is the logical root of all Views contained within a 100 // The NonClientView is the logical root of all Views contained within a
105 // Window, except for the RootView which is its parent and of which it is the 101 // Window, except for the RootView which is its parent and of which it is the
106 // sole child. The NonClientView has two children, the NonClientFrameView which 102 // sole child. The NonClientView has two children, the NonClientFrameView which
107 // is responsible for painting and responding to events from the non-client 103 // is responsible for painting and responding to events from the non-client
108 // portions of the window, and the ClientView, which is responsible for the 104 // portions of the window, and the ClientView, which is responsible for the
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Called by the containing Window when it is closed. 155 // Called by the containing Window when it is closed.
160 void WindowClosing(); 156 void WindowClosing();
161 157
162 // Replaces the frame view with a new one. Used when switching window theme 158 // Replaces the frame view with a new one. Used when switching window theme
163 // or frame style. 159 // or frame style.
164 void UpdateFrame(); 160 void UpdateFrame();
165 161
166 // Prevents the window from being rendered as deactivated when |disable| is 162 // Prevents the window from being rendered as deactivated when |disable| is
167 // true, until called with |disable| false. Used when a sub-window is to be 163 // true, until called with |disable| false. Used when a sub-window is to be
168 // shown that shouldn't visually de-activate the window. 164 // shown that shouldn't visually de-activate the window.
169 // Subclasses can override this to perform additional actions when this value
170 // changes.
171 void SetInactiveRenderingDisabled(bool disable); 165 void SetInactiveRenderingDisabled(bool disable);
172 166
173 // Returns the bounds of the window required to display the content area at 167 // Returns the bounds of the window required to display the content area at
174 // the specified bounds. 168 // the specified bounds.
175 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const; 169 gfx::Rect GetWindowBoundsForClientBounds(const gfx::Rect client_bounds) const;
176 170
177 // Determines the windows HT* code when the mouse cursor is at the 171 // Determines the windows HT* code when the mouse cursor is at the
178 // specified point, in window coordinates. 172 // specified point, in window coordinates.
179 int NonClientHitTest(const gfx::Point& point); 173 int NonClientHitTest(const gfx::Point& point);
180 174
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 238
245 // The accessible name of this view. 239 // The accessible name of this view.
246 base::string16 accessible_name_; 240 base::string16 accessible_name_;
247 241
248 DISALLOW_COPY_AND_ASSIGN(NonClientView); 242 DISALLOW_COPY_AND_ASSIGN(NonClientView);
249 }; 243 };
250 244
251 } // namespace views 245 } // namespace views
252 246
253 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_ 247 #endif // UI_VIEWS_WINDOW_NON_CLIENT_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/widget/widget.cc ('k') | ui/views/window/non_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698