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

Side by Side Diff: athena/env/athena_env_impl.cc

Issue 623103002: replace OVERRIDE and FINAL with override and final in athena/ (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 2014 The Chromium Authors. All rights reserved. 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 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 "athena/env/public/athena_env.h" 5 #include "athena/env/public/athena_env.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "athena/util/fill_layout_manager.h" 9 #include "athena/util/fill_layout_manager.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 screen_for_shutdown = new ScreenForShutdown(screen->GetPrimaryDisplay()); 49 screen_for_shutdown = new ScreenForShutdown(screen->GetPrimaryDisplay());
50 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, 50 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
51 screen_for_shutdown); 51 screen_for_shutdown);
52 } 52 }
53 53
54 private: 54 private:
55 explicit ScreenForShutdown(const gfx::Display& primary_display) 55 explicit ScreenForShutdown(const gfx::Display& primary_display)
56 : primary_display_(primary_display) {} 56 : primary_display_(primary_display) {}
57 57
58 // gfx::Screen overrides: 58 // gfx::Screen overrides:
59 virtual bool IsDIPEnabled() OVERRIDE { return true; } 59 virtual bool IsDIPEnabled() override { return true; }
60 virtual gfx::Point GetCursorScreenPoint() OVERRIDE { return gfx::Point(); } 60 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
61 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE { return NULL; } 61 virtual gfx::NativeWindow GetWindowUnderCursor() override { return NULL; }
62 virtual gfx::NativeWindow GetWindowAtScreenPoint( 62 virtual gfx::NativeWindow GetWindowAtScreenPoint(
63 const gfx::Point& point) OVERRIDE { 63 const gfx::Point& point) override {
64 return NULL; 64 return NULL;
65 } 65 }
66 virtual int GetNumDisplays() const OVERRIDE { return 1; } 66 virtual int GetNumDisplays() const override { return 1; }
67 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { 67 virtual std::vector<gfx::Display> GetAllDisplays() const override {
68 std::vector<gfx::Display> displays(1, primary_display_); 68 std::vector<gfx::Display> displays(1, primary_display_);
69 return displays; 69 return displays;
70 } 70 }
71 virtual gfx::Display GetDisplayNearestWindow( 71 virtual gfx::Display GetDisplayNearestWindow(
72 gfx::NativeView view) const OVERRIDE { 72 gfx::NativeView view) const override {
73 return primary_display_; 73 return primary_display_;
74 } 74 }
75 virtual gfx::Display GetDisplayNearestPoint( 75 virtual gfx::Display GetDisplayNearestPoint(
76 const gfx::Point& point) const OVERRIDE { 76 const gfx::Point& point) const override {
77 return primary_display_; 77 return primary_display_;
78 } 78 }
79 virtual gfx::Display GetDisplayMatching( 79 virtual gfx::Display GetDisplayMatching(
80 const gfx::Rect& match_rect) const OVERRIDE { 80 const gfx::Rect& match_rect) const override {
81 return primary_display_; 81 return primary_display_;
82 } 82 }
83 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { 83 virtual gfx::Display GetPrimaryDisplay() const override {
84 return primary_display_; 84 return primary_display_;
85 } 85 }
86 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { 86 virtual void AddObserver(gfx::DisplayObserver* observer) override {
87 NOTREACHED() << "Observer should not be added during shutdown"; 87 NOTREACHED() << "Observer should not be added during shutdown";
88 } 88 }
89 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE {} 89 virtual void RemoveObserver(gfx::DisplayObserver* observer) override {}
90 90
91 const gfx::Display primary_display_; 91 const gfx::Display primary_display_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown); 93 DISALLOW_COPY_AND_ASSIGN(ScreenForShutdown);
94 }; 94 };
95 95
96 // A class that bridges the gap between CursorManager and Aura. It borrows 96 // A class that bridges the gap between CursorManager and Aura. It borrows
97 // heavily from AshNativeCursorManager. 97 // heavily from AshNativeCursorManager.
98 class AthenaNativeCursorManager : public wm::NativeCursorManager { 98 class AthenaNativeCursorManager : public wm::NativeCursorManager {
99 public: 99 public:
100 explicit AthenaNativeCursorManager(aura::WindowTreeHost* host) 100 explicit AthenaNativeCursorManager(aura::WindowTreeHost* host)
101 : host_(host), image_cursors_(new ui::ImageCursors) {} 101 : host_(host), image_cursors_(new ui::ImageCursors) {}
102 virtual ~AthenaNativeCursorManager() {} 102 virtual ~AthenaNativeCursorManager() {}
103 103
104 // wm::NativeCursorManager overrides. 104 // wm::NativeCursorManager overrides.
105 virtual void SetDisplay(const gfx::Display& display, 105 virtual void SetDisplay(const gfx::Display& display,
106 wm::NativeCursorManagerDelegate* delegate) OVERRIDE { 106 wm::NativeCursorManagerDelegate* delegate) override {
107 if (image_cursors_->SetDisplay(display, display.device_scale_factor())) 107 if (image_cursors_->SetDisplay(display, display.device_scale_factor()))
108 SetCursor(delegate->GetCursor(), delegate); 108 SetCursor(delegate->GetCursor(), delegate);
109 } 109 }
110 110
111 virtual void SetCursor(gfx::NativeCursor cursor, 111 virtual void SetCursor(gfx::NativeCursor cursor,
112 wm::NativeCursorManagerDelegate* delegate) OVERRIDE { 112 wm::NativeCursorManagerDelegate* delegate) override {
113 image_cursors_->SetPlatformCursor(&cursor); 113 image_cursors_->SetPlatformCursor(&cursor);
114 cursor.set_device_scale_factor(image_cursors_->GetScale()); 114 cursor.set_device_scale_factor(image_cursors_->GetScale());
115 delegate->CommitCursor(cursor); 115 delegate->CommitCursor(cursor);
116 116
117 if (delegate->IsCursorVisible()) 117 if (delegate->IsCursorVisible())
118 ApplyCursor(cursor); 118 ApplyCursor(cursor);
119 } 119 }
120 120
121 virtual void SetVisibility( 121 virtual void SetVisibility(
122 bool visible, 122 bool visible,
123 wm::NativeCursorManagerDelegate* delegate) OVERRIDE { 123 wm::NativeCursorManagerDelegate* delegate) override {
124 delegate->CommitVisibility(visible); 124 delegate->CommitVisibility(visible);
125 125
126 if (visible) { 126 if (visible) {
127 SetCursor(delegate->GetCursor(), delegate); 127 SetCursor(delegate->GetCursor(), delegate);
128 } else { 128 } else {
129 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 129 gfx::NativeCursor invisible_cursor(ui::kCursorNone);
130 image_cursors_->SetPlatformCursor(&invisible_cursor); 130 image_cursors_->SetPlatformCursor(&invisible_cursor);
131 ApplyCursor(invisible_cursor); 131 ApplyCursor(invisible_cursor);
132 } 132 }
133 } 133 }
134 134
135 virtual void SetCursorSet( 135 virtual void SetCursorSet(
136 ui::CursorSetType cursor_set, 136 ui::CursorSetType cursor_set,
137 wm::NativeCursorManagerDelegate* delegate) OVERRIDE { 137 wm::NativeCursorManagerDelegate* delegate) override {
138 image_cursors_->SetCursorSet(cursor_set); 138 image_cursors_->SetCursorSet(cursor_set);
139 delegate->CommitCursorSet(cursor_set); 139 delegate->CommitCursorSet(cursor_set);
140 if (delegate->IsCursorVisible()) 140 if (delegate->IsCursorVisible())
141 SetCursor(delegate->GetCursor(), delegate); 141 SetCursor(delegate->GetCursor(), delegate);
142 } 142 }
143 143
144 virtual void SetMouseEventsEnabled( 144 virtual void SetMouseEventsEnabled(
145 bool enabled, 145 bool enabled,
146 wm::NativeCursorManagerDelegate* delegate) OVERRIDE { 146 wm::NativeCursorManagerDelegate* delegate) override {
147 delegate->CommitMouseEventsEnabled(enabled); 147 delegate->CommitMouseEventsEnabled(enabled);
148 SetVisibility(delegate->IsCursorVisible(), delegate); 148 SetVisibility(delegate->IsCursorVisible(), delegate);
149 } 149 }
150 150
151 private: 151 private:
152 // Sets |cursor| as the active cursor within Aura. 152 // Sets |cursor| as the active cursor within Aura.
153 void ApplyCursor(gfx::NativeCursor cursor) { host_->SetCursor(cursor); } 153 void ApplyCursor(gfx::NativeCursor cursor) { host_->SetCursor(cursor); }
154 154
155 aura::WindowTreeHost* host_; // Not owned. 155 aura::WindowTreeHost* host_; // Not owned.
156 156
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 private: 253 private:
254 struct Finder { 254 struct Finder {
255 explicit Finder(const base::Closure& c) : closure(c) {} 255 explicit Finder(const base::Closure& c) : closure(c) {}
256 bool operator()(const base::Closure& other) { 256 bool operator()(const base::Closure& other) {
257 return closure.Equals(other); 257 return closure.Equals(other);
258 } 258 }
259 base::Closure closure; 259 base::Closure closure;
260 }; 260 };
261 261
262 // AthenaEnv: 262 // AthenaEnv:
263 virtual aura::WindowTreeHost* GetHost() OVERRIDE { return host_.get(); } 263 virtual aura::WindowTreeHost* GetHost() override { return host_.get(); }
264 264
265 virtual void SetDisplayWorkAreaInsets(const gfx::Insets& insets) OVERRIDE { 265 virtual void SetDisplayWorkAreaInsets(const gfx::Insets& insets) override {
266 screen_->SetWorkAreaInsets(insets); 266 screen_->SetWorkAreaInsets(insets);
267 } 267 }
268 268
269 virtual void AddTerminatingCallback(const base::Closure& closure) OVERRIDE { 269 virtual void AddTerminatingCallback(const base::Closure& closure) override {
270 if (closure.is_null()) 270 if (closure.is_null())
271 return; 271 return;
272 DCHECK(terminating_callbacks_.end() == 272 DCHECK(terminating_callbacks_.end() ==
273 std::find_if(terminating_callbacks_.begin(), 273 std::find_if(terminating_callbacks_.begin(),
274 terminating_callbacks_.end(), 274 terminating_callbacks_.end(),
275 Finder(closure))); 275 Finder(closure)));
276 terminating_callbacks_.push_back(closure); 276 terminating_callbacks_.push_back(closure);
277 } 277 }
278 278
279 virtual void RemoveTerminatingCallback( 279 virtual void RemoveTerminatingCallback(
280 const base::Closure& closure) OVERRIDE { 280 const base::Closure& closure) override {
281 std::vector<base::Closure>::iterator iter = 281 std::vector<base::Closure>::iterator iter =
282 std::find_if(terminating_callbacks_.begin(), 282 std::find_if(terminating_callbacks_.begin(),
283 terminating_callbacks_.end(), 283 terminating_callbacks_.end(),
284 Finder(closure)); 284 Finder(closure));
285 if (iter != terminating_callbacks_.end()) 285 if (iter != terminating_callbacks_.end())
286 terminating_callbacks_.erase(iter); 286 terminating_callbacks_.erase(iter);
287 } 287 }
288 288
289 virtual void OnTerminating() OVERRIDE { 289 virtual void OnTerminating() override {
290 for (std::vector<base::Closure>::iterator iter = 290 for (std::vector<base::Closure>::iterator iter =
291 terminating_callbacks_.begin(); 291 terminating_callbacks_.begin();
292 iter != terminating_callbacks_.end(); 292 iter != terminating_callbacks_.end();
293 ++iter) { 293 ++iter) {
294 iter->Run(); 294 iter->Run();
295 } 295 }
296 } 296 }
297 297
298 // ui::DisplayConfigurator::Observer: 298 // ui::DisplayConfigurator::Observer:
299 virtual void OnDisplayModeChanged(const std::vector< 299 virtual void OnDisplayModeChanged(const std::vector<
300 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE { 300 ui::DisplayConfigurator::DisplayState>& displays) override {
301 gfx::Size size = GetPrimaryDisplaySize(); 301 gfx::Size size = GetPrimaryDisplaySize();
302 if (!size.IsEmpty()) 302 if (!size.IsEmpty())
303 host_->UpdateRootWindowSize(size); 303 host_->UpdateRootWindowSize(size);
304 } 304 }
305 305
306 // aura::WindowTreeHostObserver: 306 // aura::WindowTreeHostObserver:
307 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE { 307 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) override {
308 base::MessageLoopForUI::current()->PostTask( 308 base::MessageLoopForUI::current()->PostTask(
309 FROM_HERE, base::MessageLoop::QuitClosure()); 309 FROM_HERE, base::MessageLoop::QuitClosure());
310 } 310 }
311 311
312 gfx::Size GetPrimaryDisplaySize() const { 312 gfx::Size GetPrimaryDisplaySize() const {
313 const std::vector<ui::DisplayConfigurator::DisplayState>& displays = 313 const std::vector<ui::DisplayConfigurator::DisplayState>& displays =
314 display_configurator_->cached_displays(); 314 display_configurator_->cached_displays();
315 if (displays.empty()) 315 if (displays.empty())
316 return gfx::Size(); 316 return gfx::Size();
317 const ui::DisplayMode* mode = displays[0].display->current_mode(); 317 const ui::DisplayMode* mode = displays[0].display->current_mode();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 // static 350 // static
351 351
352 // static 352 // static
353 void AthenaEnv::Shutdown() { 353 void AthenaEnv::Shutdown() {
354 DCHECK(instance); 354 DCHECK(instance);
355 delete instance; 355 delete instance;
356 } 356 }
357 357
358 } // namespace athena 358 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/web_contents_view_delegate_factory_impl.cc ('k') | athena/extensions/athena_app_delegate_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698