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

Side by Side Diff: ui/aura/test/event_generator_delegate_aura.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
« no previous file with comments | « ui/accessibility/platform/atk_util_auralinux.cc ('k') | ui/base/clipboard/clipboard_aurax11.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 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/aura/test/event_generator_delegate_aura.h" 5 #include "ui/aura/test/event_generator_delegate_aura.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "ui/aura/client/screen_position_client.h" 8 #include "ui/aura/client/screen_position_client.h"
9 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/aura/window_tree_host.h" 10 #include "ui/aura/window_tree_host.h"
11 11
12 namespace aura { 12 namespace aura {
13 namespace test { 13 namespace test {
14 namespace { 14 namespace {
15 15
16 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura { 16 class DefaultEventGeneratorDelegate : public EventGeneratorDelegateAura {
17 public: 17 public:
18 static DefaultEventGeneratorDelegate* GetInstance() { 18 static DefaultEventGeneratorDelegate* GetInstance() {
19 return Singleton<DefaultEventGeneratorDelegate>::get(); 19 return base::Singleton<DefaultEventGeneratorDelegate>::get();
20 } 20 }
21 21
22 // EventGeneratorDelegate: 22 // EventGeneratorDelegate:
23 void SetContext(ui::test::EventGenerator* owner, 23 void SetContext(ui::test::EventGenerator* owner,
24 gfx::NativeWindow root_window, 24 gfx::NativeWindow root_window,
25 gfx::NativeWindow window) override { 25 gfx::NativeWindow window) override {
26 root_window_ = root_window; 26 root_window_ = root_window;
27 } 27 }
28 28
29 // EventGeneratorDelegateAura: 29 // EventGeneratorDelegateAura:
30 WindowTreeHost* GetHostAt(const gfx::Point& point) const override { 30 WindowTreeHost* GetHostAt(const gfx::Point& point) const override {
31 return root_window_->GetHost(); 31 return root_window_->GetHost();
32 } 32 }
33 33
34 client::ScreenPositionClient* GetScreenPositionClient( 34 client::ScreenPositionClient* GetScreenPositionClient(
35 const aura::Window* window) const override { 35 const aura::Window* window) const override {
36 return NULL; 36 return NULL;
37 } 37 }
38 38
39 private: 39 private:
40 friend struct DefaultSingletonTraits<DefaultEventGeneratorDelegate>; 40 friend struct base::DefaultSingletonTraits<DefaultEventGeneratorDelegate>;
41 41
42 DefaultEventGeneratorDelegate() : root_window_(NULL) { 42 DefaultEventGeneratorDelegate() : root_window_(NULL) {
43 DCHECK(!ui::test::EventGenerator::default_delegate); 43 DCHECK(!ui::test::EventGenerator::default_delegate);
44 ui::test::EventGenerator::default_delegate = this; 44 ui::test::EventGenerator::default_delegate = this;
45 } 45 }
46 46
47 ~DefaultEventGeneratorDelegate() override { 47 ~DefaultEventGeneratorDelegate() override {
48 DCHECK_EQ(this, ui::test::EventGenerator::default_delegate); 48 DCHECK_EQ(this, ui::test::EventGenerator::default_delegate);
49 ui::test::EventGenerator::default_delegate = NULL; 49 ui::test::EventGenerator::default_delegate = NULL;
50 } 50 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 void EventGeneratorDelegateAura::ConvertPointFromHost( 122 void EventGeneratorDelegateAura::ConvertPointFromHost(
123 const ui::EventTarget* hosted_target, 123 const ui::EventTarget* hosted_target,
124 gfx::Point* point) const { 124 gfx::Point* point) const {
125 const Window* window = WindowFromTarget(hosted_target); 125 const Window* window = WindowFromTarget(hosted_target);
126 window->GetHost()->ConvertPointFromHost(point); 126 window->GetHost()->ConvertPointFromHost(point);
127 } 127 }
128 128
129 } // namespace test 129 } // namespace test
130 } // namespace aura 130 } // namespace aura
OLDNEW
« no previous file with comments | « ui/accessibility/platform/atk_util_auralinux.cc ('k') | ui/base/clipboard/clipboard_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698