OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 #include "ui/wm/core/cursor_manager.h" | 27 #include "ui/wm/core/cursor_manager.h" |
28 #include "ui/wm/core/input_method_event_filter.h" | 28 #include "ui/wm/core/input_method_event_filter.h" |
29 #include "ui/wm/core/native_cursor_manager.h" | 29 #include "ui/wm/core/native_cursor_manager.h" |
30 #include "ui/wm/core/native_cursor_manager_delegate.h" | 30 #include "ui/wm/core/native_cursor_manager_delegate.h" |
31 #include "ui/wm/core/user_activity_detector.h" | 31 #include "ui/wm/core/user_activity_detector.h" |
32 | 32 |
33 namespace athena { | 33 namespace athena { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 AthenaEnv* instance = NULL; | 37 AthenaEnv* instance = nullptr; |
38 | 38 |
39 // Screen object used during shutdown. | 39 // Screen object used during shutdown. |
40 gfx::Screen* screen_for_shutdown = NULL; | 40 gfx::Screen* screen_for_shutdown = nullptr; |
41 | 41 |
42 // TODO(flackr:oshima): Remove this once athena switches to share | 42 // TODO(flackr:oshima): Remove this once athena switches to share |
43 // ash::DisplayManager. | 43 // ash::DisplayManager. |
44 class ScreenForShutdown : public gfx::Screen { | 44 class ScreenForShutdown : public gfx::Screen { |
45 public: | 45 public: |
46 // Creates and sets the screen for shutdown. Deletes existing one if any. | 46 // Creates and sets the screen for shutdown. Deletes existing one if any. |
47 static void Create(const gfx::Screen* screen) { | 47 static void Create(const gfx::Screen* screen) { |
48 delete screen_for_shutdown; | 48 delete screen_for_shutdown; |
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 gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } | 59 virtual gfx::Point GetCursorScreenPoint() override { return gfx::Point(); } |
60 virtual gfx::NativeWindow GetWindowUnderCursor() override { return NULL; } | 60 virtual gfx::NativeWindow GetWindowUnderCursor() override { return nullptr; } |
61 virtual gfx::NativeWindow GetWindowAtScreenPoint( | 61 virtual gfx::NativeWindow GetWindowAtScreenPoint( |
62 const gfx::Point& point) override { | 62 const gfx::Point& point) override { |
63 return NULL; | 63 return nullptr; |
64 } | 64 } |
65 virtual int GetNumDisplays() const override { return 1; } | 65 virtual int GetNumDisplays() const override { return 1; } |
66 virtual std::vector<gfx::Display> GetAllDisplays() const override { | 66 virtual std::vector<gfx::Display> GetAllDisplays() const override { |
67 std::vector<gfx::Display> displays(1, primary_display_); | 67 std::vector<gfx::Display> displays(1, primary_display_); |
68 return displays; | 68 return displays; |
69 } | 69 } |
70 virtual gfx::Display GetDisplayNearestWindow( | 70 virtual gfx::Display GetDisplayNearestWindow( |
71 gfx::NativeView view) const override { | 71 gfx::NativeView view) const override { |
72 return primary_display_; | 72 return primary_display_; |
73 } | 73 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 user_activity_detector_.get())); | 212 user_activity_detector_.get())); |
213 | 213 |
214 host_->AddObserver(this); | 214 host_->AddObserver(this); |
215 host_->Show(); | 215 host_->Show(); |
216 | 216 |
217 DCHECK(!instance); | 217 DCHECK(!instance); |
218 instance = this; | 218 instance = this; |
219 } | 219 } |
220 | 220 |
221 virtual ~AthenaEnvImpl() { | 221 virtual ~AthenaEnvImpl() { |
222 instance = NULL; | 222 instance = nullptr; |
223 | 223 |
224 host_->RemoveObserver(this); | 224 host_->RemoveObserver(this); |
225 if (input_method_filter_) | 225 if (input_method_filter_) |
226 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); | 226 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); |
227 if (user_activity_detector_) { | 227 if (user_activity_detector_) { |
228 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( | 228 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( |
229 user_activity_detector_.get()); | 229 user_activity_detector_.get()); |
230 } | 230 } |
231 root_window_event_filter_.reset(); | 231 root_window_event_filter_.reset(); |
232 capture_client_.reset(); | 232 capture_client_.reset(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 // static | 346 // static |
347 | 347 |
348 // static | 348 // static |
349 void AthenaEnv::Shutdown() { | 349 void AthenaEnv::Shutdown() { |
350 DCHECK(instance); | 350 DCHECK(instance); |
351 delete instance; | 351 delete instance; |
352 } | 352 } |
353 | 353 |
354 } // namespace athena | 354 } // namespace athena |
OLD | NEW |