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

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

Issue 16032015: Extensions: pass ChromeV8Context around instead of v8::Handle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 6 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
Index: chrome/renderer/extensions/app_bindings.cc
diff --git a/chrome/renderer/extensions/app_bindings.cc b/chrome/renderer/extensions/app_bindings.cc
index b036bb230662d19054190de98ed067c8dfa9bb02..c6c5abc83d976ffb4e4cb3bbf774c82aacca1815 100644
--- a/chrome/renderer/extensions/app_bindings.cc
+++ b/chrome/renderer/extensions/app_bindings.cc
@@ -57,7 +57,7 @@ const char* kInvalidCallbackIdError = "Invalid callbackId";
} // namespace
AppBindings::AppBindings(Dispatcher* dispatcher, ChromeV8Context* context)
- : ChromeV8Extension(dispatcher, context->v8_context()),
+ : ChromeV8Extension(dispatcher, context),
ChromeV8ExtensionHandler(context) {
RouteFunction("GetIsInstalled",
base::Bind(&AppBindings::GetIsInstalled, base::Unretained(this)));
@@ -73,7 +73,7 @@ AppBindings::AppBindings(Dispatcher* dispatcher, ChromeV8Context* context)
v8::Handle<v8::Value> AppBindings::GetIsInstalled(
const v8::Arguments& args) {
- const Extension* extension = context_->extension();
+ const Extension* extension = context()->extension();
// TODO(aa): Why only hosted app?
bool result = extension && extension->is_hosted_app() &&
@@ -83,14 +83,14 @@ v8::Handle<v8::Value> AppBindings::GetIsInstalled(
v8::Handle<v8::Value> AppBindings::GetDetails(
const v8::Arguments& args) {
- CHECK(context_->web_frame());
- return GetDetailsForFrameImpl(context_->web_frame());
+ CHECK(context()->web_frame());
+ return GetDetailsForFrameImpl(context()->web_frame());
}
v8::Handle<v8::Value> AppBindings::GetDetailsForFrame(
const v8::Arguments& args) {
- CHECK(context_->web_frame());
- if (!CheckAccessToAppDetails(context_->web_frame()))
+ CHECK(context()->web_frame());
+ if (!CheckAccessToAppDetails(context()->web_frame()))
return v8::Undefined();
if (args.Length() < 0)
@@ -143,11 +143,11 @@ v8::Handle<v8::Value> AppBindings::GetInstallState(const v8::Arguments& args) {
callback_id = args[0]->Int32Value();
}
- content::RenderView* render_view = context_->GetRenderView();
+ content::RenderView* render_view = context()->GetRenderView();
CHECK(render_view);
Send(new ExtensionHostMsg_GetAppInstallState(
- render_view->GetRoutingID(), context_->web_frame()->document().url(),
+ render_view->GetRoutingID(), context()->web_frame()->document().url(),
GetRoutingID(), callback_id));
return v8::Undefined();
}
@@ -155,7 +155,7 @@ v8::Handle<v8::Value> AppBindings::GetInstallState(const v8::Arguments& args) {
v8::Handle<v8::Value> AppBindings::GetRunningState(const v8::Arguments& args) {
// To distinguish between ready_to_run and cannot_run states, we need the top
// level frame.
- const WebFrame* parent_frame = context_->web_frame();
+ const WebFrame* parent_frame = context()->web_frame();
while (parent_frame->parent())
parent_frame = parent_frame->parent();
@@ -166,8 +166,8 @@ v8::Handle<v8::Value> AppBindings::GetRunningState(const v8::Arguments& args) {
ExtensionURLInfo(parent_frame->document().url()));
// The app associated with this frame.
- const Extension* this_app = extensions->GetHostedAppByURL(
- ExtensionURLInfo(context_->web_frame()->document().url()));
+ const Extension* this_app = extensions->GetHostedAppByURL(ExtensionURLInfo(
+ context()->web_frame()->document().url()));
if (!this_app || !parent_app)
return v8::String::New(extension_misc::kAppStateCannotRun);
@@ -199,12 +199,12 @@ bool AppBindings::OnMessageReceived(const IPC::Message& message) {
void AppBindings::OnAppInstallStateResponse(
const std::string& state, int callback_id) {
v8::HandleScope handle_scope;
- v8::Context::Scope context_scope(context_->v8_context());
+ v8::Context::Scope context_scope(context()->v8_context());
v8::Handle<v8::Value> argv[2];
argv[0] = v8::String::New(state.c_str());
argv[1] = v8::Integer::New(callback_id);
- CHECK(context_->CallChromeHiddenMethod("app.onInstallStateResponse",
- arraysize(argv), argv, NULL));
+ CHECK(context()->CallChromeHiddenMethod(
+ "app.onInstallStateResponse", arraysize(argv), argv, NULL));
}
} // namespace extensions
« no previous file with comments | « chrome/renderer/extensions/api_definitions_natives.cc ('k') | chrome/renderer/extensions/app_runtime_custom_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698