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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 623293004: replace OVERRIDE and FINAL with override and final in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/cursor_client.h" 10 #include "ui/aura/client/cursor_client.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 aura::Window* native_window = 112 aura::Window* native_window =
113 top_level_handler->top_level_widget_->GetNativeView(); 113 top_level_handler->top_level_widget_->GetNativeView();
114 child_window->AddObserver(top_level_handler); 114 child_window->AddObserver(top_level_handler);
115 native_window->AddObserver(top_level_handler); 115 native_window->AddObserver(top_level_handler);
116 top_level_handler->child_window_ = child_window; 116 top_level_handler->child_window_ = child_window;
117 return native_window; 117 return native_window;
118 } 118 }
119 119
120 // aura::WindowObserver overrides 120 // aura::WindowObserver overrides
121 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { 121 virtual void OnWindowDestroying(aura::Window* window) override {
122 window->RemoveObserver(this); 122 window->RemoveObserver(this);
123 123
124 // If the widget is being destroyed by the OS then we should not try and 124 // If the widget is being destroyed by the OS then we should not try and
125 // destroy it again. 125 // destroy it again.
126 if (top_level_widget_ && 126 if (top_level_widget_ &&
127 window == top_level_widget_->GetNativeView()) { 127 window == top_level_widget_->GetNativeView()) {
128 top_level_widget_ = NULL; 128 top_level_widget_ = NULL;
129 return; 129 return;
130 } 130 }
131 131
132 if (top_level_widget_) { 132 if (top_level_widget_) {
133 DCHECK(top_level_widget_->GetNativeView()); 133 DCHECK(top_level_widget_->GetNativeView());
134 top_level_widget_->GetNativeView()->RemoveObserver(this); 134 top_level_widget_->GetNativeView()->RemoveObserver(this);
135 // When we receive a notification that the child of the window created 135 // When we receive a notification that the child of the window created
136 // above is being destroyed we go ahead and initiate the destruction of 136 // above is being destroyed we go ahead and initiate the destruction of
137 // the corresponding widget. 137 // the corresponding widget.
138 top_level_widget_->Close(); 138 top_level_widget_->Close();
139 top_level_widget_ = NULL; 139 top_level_widget_ = NULL;
140 } 140 }
141 delete this; 141 delete this;
142 } 142 }
143 143
144 virtual void OnWindowBoundsChanged(aura::Window* window, 144 virtual void OnWindowBoundsChanged(aura::Window* window,
145 const gfx::Rect& old_bounds, 145 const gfx::Rect& old_bounds,
146 const gfx::Rect& new_bounds) OVERRIDE { 146 const gfx::Rect& new_bounds) override {
147 if (top_level_widget_ && window == child_window_) 147 if (top_level_widget_ && window == child_window_)
148 top_level_widget_->SetSize(new_bounds.size()); 148 top_level_widget_->SetSize(new_bounds.size());
149 } 149 }
150 150
151 private: 151 private:
152 DesktopNativeWidgetTopLevelHandler() 152 DesktopNativeWidgetTopLevelHandler()
153 : top_level_widget_(NULL), 153 : top_level_widget_(NULL),
154 child_window_(NULL) {} 154 child_window_(NULL) {}
155 155
156 virtual ~DesktopNativeWidgetTopLevelHandler() {} 156 virtual ~DesktopNativeWidgetTopLevelHandler() {}
(...skipping 12 matching lines...) Expand all
169 : root_window_(root_window) { 169 : root_window_(root_window) {
170 aura::client::SetWindowTreeClient(root_window_, this); 170 aura::client::SetWindowTreeClient(root_window_, this);
171 } 171 }
172 virtual ~DesktopNativeWidgetAuraWindowTreeClient() { 172 virtual ~DesktopNativeWidgetAuraWindowTreeClient() {
173 aura::client::SetWindowTreeClient(root_window_, NULL); 173 aura::client::SetWindowTreeClient(root_window_, NULL);
174 } 174 }
175 175
176 // Overridden from client::WindowTreeClient: 176 // Overridden from client::WindowTreeClient:
177 virtual aura::Window* GetDefaultParent(aura::Window* context, 177 virtual aura::Window* GetDefaultParent(aura::Window* context,
178 aura::Window* window, 178 aura::Window* window,
179 const gfx::Rect& bounds) OVERRIDE { 179 const gfx::Rect& bounds) override {
180 bool is_fullscreen = window->GetProperty(aura::client::kShowStateKey) == 180 bool is_fullscreen = window->GetProperty(aura::client::kShowStateKey) ==
181 ui::SHOW_STATE_FULLSCREEN; 181 ui::SHOW_STATE_FULLSCREEN;
182 bool is_menu = window->type() == ui::wm::WINDOW_TYPE_MENU; 182 bool is_menu = window->type() == ui::wm::WINDOW_TYPE_MENU;
183 183
184 if (is_fullscreen || is_menu) { 184 if (is_fullscreen || is_menu) {
185 bool root_is_always_on_top = false; 185 bool root_is_always_on_top = false;
186 internal::NativeWidgetPrivate* native_widget = 186 internal::NativeWidgetPrivate* native_widget =
187 DesktopNativeWidgetAura::ForWindow(root_window_); 187 DesktopNativeWidgetAura::ForWindow(root_window_);
188 if (native_widget) 188 if (native_widget)
189 root_is_always_on_top = native_widget->IsAlwaysOnTop(); 189 root_is_always_on_top = native_widget->IsAlwaysOnTop();
(...skipping 11 matching lines...) Expand all
201 }; 201 };
202 202
203 } // namespace 203 } // namespace
204 204
205 class FocusManagerEventHandler : public ui::EventHandler { 205 class FocusManagerEventHandler : public ui::EventHandler {
206 public: 206 public:
207 FocusManagerEventHandler(DesktopNativeWidgetAura* desktop_native_widget_aura) 207 FocusManagerEventHandler(DesktopNativeWidgetAura* desktop_native_widget_aura)
208 : desktop_native_widget_aura_(desktop_native_widget_aura) {} 208 : desktop_native_widget_aura_(desktop_native_widget_aura) {}
209 209
210 // Implementation of ui::EventHandler: 210 // Implementation of ui::EventHandler:
211 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { 211 virtual void OnKeyEvent(ui::KeyEvent* event) override {
212 Widget* widget = desktop_native_widget_aura_->GetWidget(); 212 Widget* widget = desktop_native_widget_aura_->GetWidget();
213 if (widget && widget->GetFocusManager()->GetFocusedView() && 213 if (widget && widget->GetFocusManager()->GetFocusedView() &&
214 !widget->GetFocusManager()->OnKeyEvent(*event)) { 214 !widget->GetFocusManager()->OnKeyEvent(*event)) {
215 event->SetHandled(); 215 event->SetHandled();
216 } 216 }
217 } 217 }
218 218
219 private: 219 private:
220 DesktopNativeWidgetAura* desktop_native_widget_aura_; 220 DesktopNativeWidgetAura* desktop_native_widget_aura_;
221 221
222 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler); 222 DISALLOW_COPY_AND_ASSIGN(FocusManagerEventHandler);
223 }; 223 };
224 224
225 class RootWindowDestructionObserver : public aura::WindowObserver { 225 class RootWindowDestructionObserver : public aura::WindowObserver {
226 public: 226 public:
227 explicit RootWindowDestructionObserver(DesktopNativeWidgetAura* parent) 227 explicit RootWindowDestructionObserver(DesktopNativeWidgetAura* parent)
228 : parent_(parent) {} 228 : parent_(parent) {}
229 virtual ~RootWindowDestructionObserver() {} 229 virtual ~RootWindowDestructionObserver() {}
230 230
231 private: 231 private:
232 // Overridden from aura::WindowObserver: 232 // Overridden from aura::WindowObserver:
233 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE { 233 virtual void OnWindowDestroyed(aura::Window* window) override {
234 parent_->RootWindowDestroyed(); 234 parent_->RootWindowDestroyed();
235 window->RemoveObserver(this); 235 window->RemoveObserver(this);
236 delete this; 236 delete this;
237 } 237 }
238 238
239 DesktopNativeWidgetAura* parent_; 239 DesktopNativeWidgetAura* parent_;
240 240
241 DISALLOW_COPY_AND_ASSIGN(RootWindowDestructionObserver); 241 DISALLOW_COPY_AND_ASSIGN(RootWindowDestructionObserver);
242 }; 242 };
243 243
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 if (cursor_reference_count_ == 0) { 1211 if (cursor_reference_count_ == 0) {
1212 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1212 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1213 // for cleaning up |cursor_manager_|. 1213 // for cleaning up |cursor_manager_|.
1214 delete cursor_manager_; 1214 delete cursor_manager_;
1215 native_cursor_manager_ = NULL; 1215 native_cursor_manager_ = NULL;
1216 cursor_manager_ = NULL; 1216 cursor_manager_ = NULL;
1217 } 1217 }
1218 } 1218 }
1219 1219
1220 } // namespace views 1220 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698