| 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 "ui/events/platform/platform_event_source.h" | 5 #include "ui/events/platform/platform_event_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "ui/events/platform/platform_event_dispatcher.h" | 11 #include "ui/events/platform/platform_event_dispatcher.h" |
| 12 #include "ui/events/platform/platform_event_observer.h" | 12 #include "ui/events/platform/platform_event_observer.h" |
| 13 #include "ui/events/platform/scoped_event_dispatcher.h" | 13 #include "ui/events/platform/scoped_event_dispatcher.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 PlatformEventSource* PlatformEventSource::instance_ = NULL; | 18 PlatformEventSource* PlatformEventSource::instance_ = NULL; |
| 19 | 19 |
| 20 PlatformEventSource::PlatformEventSource() | 20 PlatformEventSource::PlatformEventSource() |
| 21 : overridden_dispatcher_(NULL), | 21 : overridden_dispatcher_(NULL), |
| 22 overridden_dispatcher_restored_(false) { | 22 overridden_dispatcher_restored_(false) { |
| 23 CHECK(!instance_) << "Only one platform event source can be created."; | 23 // Only one platform event source can be created. |
| 24 CHECK(!instance_); |
| 24 instance_ = this; | 25 instance_ = this; |
| 25 } | 26 } |
| 26 | 27 |
| 27 PlatformEventSource::~PlatformEventSource() { | 28 PlatformEventSource::~PlatformEventSource() { |
| 28 CHECK_EQ(this, instance_); | 29 CHECK_EQ(this, instance_); |
| 29 instance_ = NULL; | 30 instance_ = NULL; |
| 30 } | 31 } |
| 31 | 32 |
| 32 PlatformEventSource* PlatformEventSource::GetInstance() { return instance_; } | 33 PlatformEventSource* PlatformEventSource::GetInstance() { return instance_; } |
| 33 | 34 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 void PlatformEventSource::OnDispatcherListChanged() { | 103 void PlatformEventSource::OnDispatcherListChanged() { |
| 103 } | 104 } |
| 104 | 105 |
| 105 void PlatformEventSource::OnOverriddenDispatcherRestored() { | 106 void PlatformEventSource::OnOverriddenDispatcherRestored() { |
| 106 CHECK(overridden_dispatcher_); | 107 CHECK(overridden_dispatcher_); |
| 107 overridden_dispatcher_restored_ = true; | 108 overridden_dispatcher_restored_ = true; |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace ui | 111 } // namespace ui |
| OLD | NEW |