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

Side by Side Diff: chrome/renderer/extensions/chrome_v8_context.cc

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/chrome_v8_context.h" 5 #include "chrome/renderer/extensions/chrome_v8_context.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 argv); 137 argv);
138 if (result) 138 if (result)
139 *result = result_temp; 139 *result = result_temp;
140 140
141 return true; 141 return true;
142 } 142 }
143 143
144 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() { 144 const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() {
145 if (!available_extension_apis_.get()) { 145 if (!available_extension_apis_.get()) {
146 available_extension_apis_ = 146 available_extension_apis_ =
147 ExtensionAPI::GetSharedInstance()->GetAPIsForContext( 147 make_scoped_ptr(new std::set<std::string>(
148 context_type_, 148 ExtensionAPI::GetSharedInstance()->GetAPIsForContext(
149 extension_, 149 context_type_,
150 UserScriptSlave::GetDataSourceURLForFrame( 150 extension_,
151 web_frame_)).Pass(); 151 UserScriptSlave::GetDataSourceURLForFrame(
152 web_frame_)))).Pass();
152 } 153 }
153 return *(available_extension_apis_.get()); 154 return *(available_extension_apis_.get());
not at google - send to devlin 2012/12/14 00:44:00 use .reset(new ...)
cduvall 2012/12/14 02:04:50 Done.
154 } 155 }
155 156
156 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process, 157 void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process,
157 int manifest_version) { 158 int manifest_version) {
158 v8::HandleScope handle_scope; 159 v8::HandleScope handle_scope;
159 v8::Handle<v8::Value> argv[] = { 160 v8::Handle<v8::Value> argv[] = {
160 v8::String::New(GetExtensionID().c_str()), 161 v8::String::New(GetExtensionID().c_str()),
161 v8::String::New(GetContextTypeDescription().c_str()), 162 v8::String::New(GetContextTypeDescription().c_str()),
162 v8::Boolean::New(is_incognito_process), 163 v8::Boolean::New(is_incognito_process),
163 v8::Integer::New(manifest_version), 164 v8::Integer::New(manifest_version),
(...skipping 12 matching lines...) Expand all
176 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION"; 177 case Feature::BLESSED_EXTENSION_CONTEXT: return "BLESSED_EXTENSION";
177 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION"; 178 case Feature::UNBLESSED_EXTENSION_CONTEXT: return "UNBLESSED_EXTENSION";
178 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT"; 179 case Feature::CONTENT_SCRIPT_CONTEXT: return "CONTENT_SCRIPT";
179 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE"; 180 case Feature::WEB_PAGE_CONTEXT: return "WEB_PAGE";
180 } 181 }
181 NOTREACHED(); 182 NOTREACHED();
182 return ""; 183 return "";
183 } 184 }
184 185
185 } // namespace extensions 186 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698