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

Side by Side Diff: third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp

Issue 2196843003: Blink ServiceRegistry -> InterfaceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/webshare/NavigatorShare.h" 5 #include "modules/webshare/NavigatorShare.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExceptionCode.h" 9 #include "core/dom/ExceptionCode.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
11 #include "core/frame/Navigator.h" 11 #include "core/frame/Navigator.h"
12 #include "platform/mojo/MojoHelper.h" 12 #include "platform/mojo/MojoHelper.h"
13 #include "public/platform/InterfaceProvider.h"
13 #include "public/platform/Platform.h" 14 #include "public/platform/Platform.h"
14 #include "public/platform/ServiceRegistry.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class NavigatorShare::ShareClientImpl final : public GarbageCollected<ShareClien tImpl> { 18 class NavigatorShare::ShareClientImpl final : public GarbageCollected<ShareClien tImpl> {
19 public: 19 public:
20 ShareClientImpl(NavigatorShare*, ScriptPromiseResolver*); 20 ShareClientImpl(NavigatorShare*, ScriptPromiseResolver*);
21 21
22 void callback(const String& error); 22 void callback(const String& error);
23 23
24 DEFINE_INLINE_TRACE() 24 DEFINE_INLINE_TRACE()
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return "NavigatorShare"; 78 return "NavigatorShare";
79 } 79 }
80 80
81 ScriptPromise NavigatorShare::share(ScriptState* scriptState, const String& titl e, const String& text) 81 ScriptPromise NavigatorShare::share(ScriptState* scriptState, const String& titl e, const String& text)
82 { 82 {
83 if (!m_service) { 83 if (!m_service) {
84 Document* doc = toDocument(scriptState->getExecutionContext()); 84 Document* doc = toDocument(scriptState->getExecutionContext());
85 DCHECK(doc); 85 DCHECK(doc);
86 LocalFrame* frame = doc->frame(); 86 LocalFrame* frame = doc->frame();
87 DCHECK(frame); 87 DCHECK(frame);
88 frame->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_servi ce)); 88 frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service));
89 DCHECK(m_service); 89 DCHECK(m_service);
90 } 90 }
91 91
92 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 92 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
93 ShareClientImpl* client = new ShareClientImpl(this, resolver); 93 ShareClientImpl* client = new ShareClientImpl(this, resolver);
94 m_clients.add(client); 94 m_clients.add(client);
95 ScriptPromise promise = resolver->promise(); 95 ScriptPromise promise = resolver->promise();
96 96
97 m_service->Share(title, text, convertToBaseCallback(WTF::bind(&ShareClientIm pl::callback, wrapPersistent(client)))); 97 m_service->Share(title, text, convertToBaseCallback(WTF::bind(&ShareClientIm pl::callback, wrapPersistent(client))));
98 98
99 return promise; 99 return promise;
100 } 100 }
101 101
102 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat or, const String& title, const String& text) 102 ScriptPromise NavigatorShare::share(ScriptState* scriptState, Navigator& navigat or, const String& title, const String& text)
103 { 103 {
104 return from(navigator).share(scriptState, title, text); 104 return from(navigator).share(scriptState, title, text);
105 } 105 }
106 106
107 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698