Chromium Code Reviews| 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..e96c26ec3d452e21302dcfabb45ee0bb873d7492 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 = ChromeV8ExtensionHandler::context_->extension(); |
|
not at google - send to devlin
2013/05/29 15:55:13
see comment in ObjectBackedNativeHandler: could yo
marja
2013/05/29 16:56:33
Done.
|
| // TODO(aa): Why only hosted app? |
| bool result = extension && extension->is_hosted_app() && |
| @@ -83,14 +83,15 @@ 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(ChromeV8ExtensionHandler::context_->web_frame()); |
| + return GetDetailsForFrameImpl( |
| + ChromeV8ExtensionHandler::context_->web_frame()); |
| } |
| v8::Handle<v8::Value> AppBindings::GetDetailsForFrame( |
| const v8::Arguments& args) { |
| - CHECK(context_->web_frame()); |
| - if (!CheckAccessToAppDetails(context_->web_frame())) |
| + CHECK(ChromeV8ExtensionHandler::context_->web_frame()); |
| + if (!CheckAccessToAppDetails(ChromeV8ExtensionHandler::context_->web_frame())) |
| return v8::Undefined(); |
| if (args.Length() < 0) |
| @@ -143,19 +144,23 @@ 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 = |
| + ChromeV8ExtensionHandler::context_->GetRenderView(); |
| CHECK(render_view); |
| Send(new ExtensionHostMsg_GetAppInstallState( |
| - render_view->GetRoutingID(), context_->web_frame()->document().url(), |
| - GetRoutingID(), callback_id)); |
| + render_view->GetRoutingID(), |
| + ChromeV8ExtensionHandler::context_->web_frame()->document().url(), |
| + GetRoutingID(), |
| + callback_id)); |
| return v8::Undefined(); |
| } |
| 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 = |
| + ChromeV8ExtensionHandler::context_->web_frame(); |
| while (parent_frame->parent()) |
| parent_frame = parent_frame->parent(); |
| @@ -166,8 +171,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( |
| + ChromeV8ExtensionHandler::context_->web_frame()->document().url())); |
| if (!this_app || !parent_app) |
| return v8::String::New(extension_misc::kAppStateCannotRun); |
| @@ -199,12 +204,13 @@ 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( |
| + ChromeV8ExtensionHandler::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(ChromeV8ExtensionHandler::context_->CallChromeHiddenMethod( |
| + "app.onInstallStateResponse", arraysize(argv), argv, NULL)); |
| } |
| } // namespace extensions |