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

Side by Side Diff: extensions/renderer/native_extension_bindings_system.cc

Issue 2494653005: Support API aliases (Closed)
Patch Set: . Created 4 years 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 "extensions/renderer/native_extension_bindings_system.h" 5 #include "extensions/renderer/native_extension_bindings_system.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "content/public/common/content_switches.h" 8 #include "content/public/common/content_switches.h"
9 #include "extensions/common/constants.h" 9 #include "extensions/common/constants.h"
10 #include "extensions/common/extension_api.h" 10 #include "extensions/common/extension_api.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (api_feature_provider->GetParent(map_entry.second.get()) != nullptr) 117 if (api_feature_provider->GetParent(map_entry.second.get()) != nullptr)
118 continue; 118 continue;
119 119
120 // Skip chrome.test if this isn't a test. 120 // Skip chrome.test if this isn't a test.
121 if (map_entry.first == "test" && 121 if (map_entry.first == "test" &&
122 !base::CommandLine::ForCurrentProcess()->HasSwitch( 122 !base::CommandLine::ForCurrentProcess()->HasSwitch(
123 ::switches::kTestType)) { 123 ::switches::kTestType)) {
124 continue; 124 continue;
125 } 125 }
126 126
127 if (!context->IsAnyFeatureAvailableToContext(*map_entry.second)) 127 if (!context->IsAnyFeatureAvailableToContext(*map_entry.second,
128 CheckAliasStatus::NOT_ALLOWED))
128 continue; 129 continue;
129 130
130 // TODO(devlin): Make this lazy by adding a getter. 131 // TODO(devlin): Make this lazy by adding a getter.
131 v8::Local<v8::Object> api_object = api_system_.CreateAPIInstance( 132 v8::Local<v8::Object> api_object = api_system_.CreateAPIInstance(
132 map_entry.first, v8_context, v8_context->GetIsolate(), 133 map_entry.first, v8_context, v8_context->GetIsolate(),
133 base::Bind(&IsAPIMethodAvailable, context)); 134 base::Bind(&IsAPIMethodAvailable, context));
134 v8::Maybe<bool> success = chrome->CreateDataProperty( 135 v8::Maybe<bool> success = chrome->CreateDataProperty(
135 v8_context, 136 v8_context,
136 gin::StringToSymbol(v8_context->GetIsolate(), map_entry.first), 137 gin::StringToSymbol(v8_context->GetIsolate(), map_entry.first),
137 api_object); 138 api_object);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 params.has_callback = request->has_callback; 198 params.has_callback = request->has_callback;
198 params.user_gesture = request->has_user_gesture; 199 params.user_gesture = request->has_user_gesture;
199 // TODO(devlin): Make this work in ServiceWorkers. 200 // TODO(devlin): Make this work in ServiceWorkers.
200 params.worker_thread_id = -1; 201 params.worker_thread_id = -1;
201 params.service_worker_version_id = kInvalidServiceWorkerVersionId; 202 params.service_worker_version_id = kInvalidServiceWorkerVersionId;
202 203
203 send_ipc_.Run(params); 204 send_ipc_.Run(params);
204 } 205 }
205 206
206 } // namespace extensions 207 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/js_extension_bindings_system.cc ('k') | extensions/renderer/script_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698