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

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp

Issue 2643063002: Refactor Blink's ServiceConnector and add ability to mock in layout tests (Closed)
Patch Set: Fix build Created 3 years, 9 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 "modules/screen_orientation/ScreenOrientationDispatcher.h" 5 #include "modules/screen_orientation/ScreenOrientationDispatcher.h"
6 6
7 #include "platform/ServiceConnector.h" 7 #include "public/platform/Connector.h"
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 #include "services/device/public/interfaces/constants.mojom-blink.h" 9 #include "services/device/public/interfaces/constants.mojom-blink.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 ScreenOrientationDispatcher& ScreenOrientationDispatcher::instance() { 13 ScreenOrientationDispatcher& ScreenOrientationDispatcher::instance() {
14 DEFINE_STATIC_LOCAL(ScreenOrientationDispatcher, screenOrientationDispatcher, 14 DEFINE_STATIC_LOCAL(ScreenOrientationDispatcher, screenOrientationDispatcher,
15 (new ScreenOrientationDispatcher)); 15 (new ScreenOrientationDispatcher));
16 return screenOrientationDispatcher; 16 return screenOrientationDispatcher;
17 } 17 }
18 18
19 ScreenOrientationDispatcher::ScreenOrientationDispatcher() {} 19 ScreenOrientationDispatcher::ScreenOrientationDispatcher() {}
20 20
21 ScreenOrientationDispatcher::~ScreenOrientationDispatcher() { 21 ScreenOrientationDispatcher::~ScreenOrientationDispatcher() {
22 DCHECK(!m_listener); 22 DCHECK(!m_listener);
23 } 23 }
24 24
25 DEFINE_TRACE(ScreenOrientationDispatcher) { 25 DEFINE_TRACE(ScreenOrientationDispatcher) {
26 PlatformEventDispatcher::trace(visitor); 26 PlatformEventDispatcher::trace(visitor);
27 } 27 }
28 28
29 void ScreenOrientationDispatcher::startListening() { 29 void ScreenOrientationDispatcher::startListening() {
30 DCHECK(!m_listener); 30 DCHECK(!m_listener);
31 31
32 ServiceConnector::instance().connectToInterface( 32 Platform::current()->connector()->bindInterface(
33 device::mojom::blink::kServiceName, mojo::MakeRequest(&m_listener)); 33 device::mojom::blink::kServiceName, mojo::MakeRequest(&m_listener));
34 m_listener->Start(); 34 m_listener->Start();
35 } 35 }
36 36
37 void ScreenOrientationDispatcher::stopListening() { 37 void ScreenOrientationDispatcher::stopListening() {
38 DCHECK(m_listener); 38 DCHECK(m_listener);
39 39
40 m_listener->Stop(); 40 m_listener->Stop();
41 m_listener.reset(); 41 m_listener.reset();
42 } 42 }
43 43
44 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698