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

Side by Side Diff: third_party/WebKit/Source/modules/installedapp/InstalledAppController.cpp

Issue 2785913003: Add an Origin Trial for Navigator.getInstalledRelatedApps. (Closed)
Patch Set: Fix tests and make non-Android-specific. Created 3 years, 8 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/installedapp/InstalledAppController.h" 5 #include "modules/installedapp/InstalledAppController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "platform/RuntimeEnabledFeatures.h"
10 #include "public/platform/InterfaceProvider.h" 9 #include "public/platform/InterfaceProvider.h"
11 #include "wtf/Functional.h" 10 #include "wtf/Functional.h"
12 11
13 #include <utility> 12 #include <utility>
14 13
15 namespace blink { 14 namespace blink {
16 15
17 // Callbacks for the result of 16 // Callbacks for the result of
18 // WebRelatedAppsFetcher::getManifestRelatedApplications. Calls 17 // WebRelatedAppsFetcher::getManifestRelatedApplications. Calls
19 // filterByInstalledApps upon receiving the list of related applications. 18 // filterByInstalledApps upon receiving the list of related applications.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Upon returning, filter the result list to those apps that are installed. 55 // Upon returning, filter the result list to those apps that are installed.
57 // TODO(mgiuca): This roundtrip to content could be eliminated if the Manifest 56 // TODO(mgiuca): This roundtrip to content could be eliminated if the Manifest
58 // class was moved from content into Blink. 57 // class was moved from content into Blink.
59 m_relatedAppsFetcher->getManifestRelatedApplications( 58 m_relatedAppsFetcher->getManifestRelatedApplications(
60 WTF::makeUnique<GetRelatedAppsCallbacks>(this, std::move(callbacks))); 59 WTF::makeUnique<GetRelatedAppsCallbacks>(this, std::move(callbacks)));
61 } 60 }
62 61
63 void InstalledAppController::provideTo( 62 void InstalledAppController::provideTo(
64 LocalFrame& frame, 63 LocalFrame& frame,
65 WebRelatedAppsFetcher* relatedAppsFetcher) { 64 WebRelatedAppsFetcher* relatedAppsFetcher) {
66 DCHECK(RuntimeEnabledFeatures::installedAppEnabled());
67
68 InstalledAppController* controller = 65 InstalledAppController* controller =
69 new InstalledAppController(frame, relatedAppsFetcher); 66 new InstalledAppController(frame, relatedAppsFetcher);
70 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); 67 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller);
71 } 68 }
72 69
73 InstalledAppController* InstalledAppController::from(LocalFrame& frame) { 70 InstalledAppController* InstalledAppController::from(LocalFrame& frame) {
74 InstalledAppController* controller = static_cast<InstalledAppController*>( 71 InstalledAppController* controller = static_cast<InstalledAppController*>(
75 Supplement<LocalFrame>::from(frame, supplementName())); 72 Supplement<LocalFrame>::from(frame, supplementName()));
76 DCHECK(controller); 73 DCHECK(controller);
77 return controller; 74 return controller;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 callbacks->onSuccess( 134 callbacks->onSuccess(
138 blink::WebVector<blink::WebRelatedApplication>(applications)); 135 blink::WebVector<blink::WebRelatedApplication>(applications));
139 } 136 }
140 137
141 DEFINE_TRACE(InstalledAppController) { 138 DEFINE_TRACE(InstalledAppController) {
142 Supplement<LocalFrame>::trace(visitor); 139 Supplement<LocalFrame>::trace(visitor);
143 ContextLifecycleObserver::trace(visitor); 140 ContextLifecycleObserver::trace(visitor);
144 } 141 }
145 142
146 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698