| 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/extensions/extension_messages.h" | 9 #include "chrome/common/extensions/extension_messages.h" |
| 10 #include "chrome/renderer/extensions/chrome_v8_context.h" | 10 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 v8::ThrowException(v8::String::New(kSuccessCallbackNotAFunctionError)); | 144 v8::ThrowException(v8::String::New(kSuccessCallbackNotAFunctionError)); |
| 145 return v8::Undefined(); | 145 return v8::Undefined(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 if (!args[2]->IsUndefined() && !args[2]->IsFunction()) { | 148 if (!args[2]->IsUndefined() && !args[2]->IsFunction()) { |
| 149 v8::ThrowException(v8::String::New(kFailureCallbackNotAFunctionError)); | 149 v8::ThrowException(v8::String::New(kFailureCallbackNotAFunctionError)); |
| 150 return v8::Undefined(); | 150 return v8::Undefined(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 Send(new ExtensionHostMsg_InlineWebstoreInstall( | 153 Send(new ExtensionHostMsg_InlineWebstoreInstall( |
| 154 render_view->GetRoutingId(), | 154 render_view->GetRoutingID(), |
| 155 install_id, | 155 install_id, |
| 156 GetRoutingId(), | 156 GetRoutingID(), |
| 157 webstore_item_id, | 157 webstore_item_id, |
| 158 frame->document().url())); | 158 frame->document().url())); |
| 159 | 159 |
| 160 return v8::Integer::New(install_id); | 160 return v8::Integer::New(install_id); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // static | 163 // static |
| 164 bool WebstoreBindingsHandler::GetWebstoreItemIdFromFrame( | 164 bool WebstoreBindingsHandler::GetWebstoreItemIdFromFrame( |
| 165 WebFrame* frame, const std::string& preferred_store_link_url, | 165 WebFrame* frame, const std::string& preferred_store_link_url, |
| 166 std::string* webstore_item_id, std::string* error) { | 166 std::string* webstore_item_id, std::string* error) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const std::string& error) { | 262 const std::string& error) { |
| 263 v8::HandleScope handle_scope; | 263 v8::HandleScope handle_scope; |
| 264 v8::Context::Scope context_scope(context_->v8_context()); | 264 v8::Context::Scope context_scope(context_->v8_context()); |
| 265 v8::Handle<v8::Value> argv[3]; | 265 v8::Handle<v8::Value> argv[3]; |
| 266 argv[0] = v8::Integer::New(install_id); | 266 argv[0] = v8::Integer::New(install_id); |
| 267 argv[1] = v8::Boolean::New(success); | 267 argv[1] = v8::Boolean::New(success); |
| 268 argv[2] = v8::String::New(error.c_str()); | 268 argv[2] = v8::String::New(error.c_str()); |
| 269 CHECK(context_->CallChromeHiddenMethod("webstore.onInstallResponse", | 269 CHECK(context_->CallChromeHiddenMethod("webstore.onInstallResponse", |
| 270 arraysize(argv), argv, NULL)); | 270 arraysize(argv), argv, NULL)); |
| 271 } | 271 } |
| OLD | NEW |