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

Unified Diff: chrome/renderer/extensions/chrome_v8_context.cc

Issue 12313142: Revert 184837 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.h ('k') | chrome/renderer/extensions/chrome_v8_context_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/chrome_v8_context.cc
===================================================================
--- chrome/renderer/extensions/chrome_v8_context.cc (revision 184858)
+++ chrome/renderer/extensions/chrome_v8_context.cc (working copy)
@@ -12,7 +12,6 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/renderer/extensions/chrome_v8_extension.h"
-#include "chrome/renderer/extensions/module_system.h"
#include "chrome/renderer/extensions/user_script_slave.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
@@ -24,10 +23,6 @@
namespace {
const char kChromeHidden[] = "chromeHidden";
-const char kUnavailableMessage[] = "You do not have permission to access this "
- "API. Ensure that the required permission "
- "or manifest property is included in your "
- "manifest.json.";
const char kValidateCallbacks[] = "validateCallbacks";
const char kValidateAPI[] = "validateAPI";
@@ -42,8 +37,7 @@
v8_context)),
web_frame_(web_frame),
extension_(extension),
- context_type_(context_type),
- available_extension_apis_initialized_(false) {
+ context_type_(context_type) {
VLOG(1) << "Created context:\n"
<< " extension id: " << GetExtensionID() << "\n"
<< " frame: " << web_frame_ << "\n"
@@ -56,12 +50,6 @@
v8_context_.Dispose(v8_context_->GetIsolate());
}
-void ChromeV8Context::Invalidate() {
- if (module_system_)
- module_system_->Invalidate();
- web_frame_ = NULL;
-}
-
std::string ChromeV8Context::GetExtensionID() {
return extension_ ? extension_->id() : "";
}
@@ -78,11 +66,11 @@
global->SetHiddenValue(v8::String::New(kChromeHidden), hidden);
if (DCHECK_IS_ON()) {
- // Tell bindings.js to validate callbacks and events against their schema
- // definitions.
+ // Tell schema_generated_bindings.js to validate callbacks and events
+ // against their schema definitions.
v8::Local<v8::Object>::Cast(hidden)->Set(
v8::String::New(kValidateCallbacks), v8::True());
- // Tell bindings.js to validate API for ambiguity.
+ // Tell schema_generated_bindings.js to validate API for ambiguity.
v8::Local<v8::Object>::Cast(hidden)->Set(
v8::String::New(kValidateAPI), v8::True());
}
@@ -111,9 +99,9 @@
v8::Handle<v8::Value>* result) const {
v8::Context::Scope context_scope(v8_context_);
- // ChromeV8ContextSet calls Invalidate() and then schedules a task to delete
- // this object. This check prevents a race from attempting to execute script
- // on a NULL web_frame_.
+ // ChromeV8ContextSet calls clear_web_frame() and then schedules a task to
+ // delete this object. This check prevents a race from attempting to execute
+ // script on a NULL web_frame_.
if (!web_frame_)
return false;
@@ -153,30 +141,17 @@
}
const std::set<std::string>& ChromeV8Context::GetAvailableExtensionAPIs() {
- if (!available_extension_apis_initialized_) {
+ if (!available_extension_apis_.get()) {
available_extension_apis_ =
ExtensionAPI::GetSharedInstance()->GetAPIsForContext(
context_type_,
extension_,
- UserScriptSlave::GetDataSourceURLForFrame(web_frame_));
- available_extension_apis_initialized_ = true;
+ UserScriptSlave::GetDataSourceURLForFrame(
+ web_frame_)).Pass();
}
- return available_extension_apis_;
+ return *(available_extension_apis_.get());
}
-Feature::Availability ChromeV8Context::GetAvailability(
- const std::string& api_name) {
- const std::set<std::string>& available_apis = GetAvailableExtensionAPIs();
-
- // TODO(cduvall/kalman): Switch to ExtensionAPI::IsAvailable() once Features
- // are complete.
- if (available_apis.find(api_name) != available_apis.end())
- return Feature::CreateAvailability(Feature::IS_AVAILABLE, "");
-
- return Feature::CreateAvailability(Feature::INVALID_CONTEXT,
- kUnavailableMessage);
-}
-
void ChromeV8Context::DispatchOnLoadEvent(bool is_incognito_process,
int manifest_version) {
v8::HandleScope handle_scope;
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.h ('k') | chrome/renderer/extensions/chrome_v8_context_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698