| OLD | NEW |
| 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/webstore_bindings.h" | 5 #include "chrome/renderer/extensions/webstore_bindings.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // chrome.webstore.install() calls generate an install ID so that the install's | 46 // chrome.webstore.install() calls generate an install ID so that the install's |
| 47 // callbacks may be fired when the browser notifies us of install completion | 47 // callbacks may be fired when the browser notifies us of install completion |
| 48 // (successful or not) via OnInlineWebstoreInstallResponse. | 48 // (successful or not) via OnInlineWebstoreInstallResponse. |
| 49 int g_next_install_id = 0; | 49 int g_next_install_id = 0; |
| 50 | 50 |
| 51 } // anonymous namespace | 51 } // anonymous namespace |
| 52 | 52 |
| 53 WebstoreBindings::WebstoreBindings(ScriptContext* context) | 53 WebstoreBindings::WebstoreBindings(ScriptContext* context) |
| 54 : ObjectBackedNativeHandler(context) { | 54 : ObjectBackedNativeHandler(context) { |
| 55 RouteFunction("Install", | 55 RouteFunction("Install", "webstore", |
| 56 base::Bind(&WebstoreBindings::Install, base::Unretained(this))); | 56 base::Bind(&WebstoreBindings::Install, base::Unretained(this))); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void WebstoreBindings::Install( | 59 void WebstoreBindings::Install( |
| 60 const v8::FunctionCallbackInfo<v8::Value>& args) { | 60 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 61 content::RenderFrame* render_frame = context()->GetRenderFrame(); | 61 content::RenderFrame* render_frame = context()->GetRenderFrame(); |
| 62 if (!render_frame) | 62 if (!render_frame) |
| 63 return; | 63 return; |
| 64 | 64 |
| 65 // The first two arguments indicate whether or not there are install stage | 65 // The first two arguments indicate whether or not there are install stage |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 v8::Isolate* isolate = context()->isolate(); | 243 v8::Isolate* isolate = context()->isolate(); |
| 244 v8::HandleScope handle_scope(isolate); | 244 v8::HandleScope handle_scope(isolate); |
| 245 v8::Context::Scope context_scope(context()->v8_context()); | 245 v8::Context::Scope context_scope(context()->v8_context()); |
| 246 v8::Local<v8::Value> argv[] = { | 246 v8::Local<v8::Value> argv[] = { |
| 247 v8::Number::New(isolate, percent_downloaded / 100.0)}; | 247 v8::Number::New(isolate, percent_downloaded / 100.0)}; |
| 248 context()->module_system()->CallModuleMethod( | 248 context()->module_system()->CallModuleMethod( |
| 249 "webstore", "onDownloadProgress", arraysize(argv), argv); | 249 "webstore", "onDownloadProgress", arraysize(argv), argv); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace extensions | 252 } // namespace extensions |
| OLD | NEW |