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

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

Issue 2765783002: Restrict Navigator.getInstalledRelatedApps() to secure contexts. (Closed)
Patch Set: fix copypaste 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 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/NavigatorInstalledApp.h" 5 #include "modules/installedapp/NavigatorInstalledApp.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 26 matching lines...) Expand all
37 if (!supplement) { 37 if (!supplement) {
38 supplement = new NavigatorInstalledApp(navigator); 38 supplement = new NavigatorInstalledApp(navigator);
39 provideTo(navigator, supplementName(), supplement); 39 provideTo(navigator, supplementName(), supplement);
40 } 40 }
41 return *supplement; 41 return *supplement;
42 } 42 }
43 43
44 ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps( 44 ScriptPromise NavigatorInstalledApp::getInstalledRelatedApps(
45 ScriptState* scriptState, 45 ScriptState* scriptState,
46 Navigator& navigator) { 46 Navigator& navigator) {
47 // [SecureContext] from the IDL ensures this.
48 DCHECK(scriptState->getExecutionContext()->isSecureContext());
47 return NavigatorInstalledApp::from(navigator).getInstalledRelatedApps( 49 return NavigatorInstalledApp::from(navigator).getInstalledRelatedApps(
48 scriptState); 50 scriptState);
49 } 51 }
50 52
51 class RelatedAppArray { 53 class RelatedAppArray {
52 STATIC_ONLY(RelatedAppArray); 54 STATIC_ONLY(RelatedAppArray);
53 55
54 public: 56 public:
55 using WebType = const WebVector<WebRelatedApplication>&; 57 using WebType = const WebVector<WebRelatedApplication>&;
56 58
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 95
94 const char* NavigatorInstalledApp::supplementName() { 96 const char* NavigatorInstalledApp::supplementName() {
95 return "NavigatorInstalledApp"; 97 return "NavigatorInstalledApp";
96 } 98 }
97 99
98 DEFINE_TRACE(NavigatorInstalledApp) { 100 DEFINE_TRACE(NavigatorInstalledApp) {
99 Supplement<Navigator>::trace(visitor); 101 Supplement<Navigator>::trace(visitor);
100 } 102 }
101 103
102 } // namespace blink 104 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698