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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 if (webstore_url.scheme() != webstore_base_url.scheme() || | 166 if (webstore_url.scheme() != webstore_base_url.scheme() || |
167 webstore_url.host() != webstore_base_url.host() || | 167 webstore_url.host() != webstore_base_url.host() || |
168 !StartsWithASCII( | 168 !StartsWithASCII( |
169 webstore_url.path(), webstore_base_url.path(), true)) { | 169 webstore_url.path(), webstore_base_url.path(), true)) { |
170 *error = kInvalidWebstoreItemUrlError; | 170 *error = kInvalidWebstoreItemUrlError; |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 std::string candidate_webstore_item_id = webstore_url.path().substr( | 174 std::string candidate_webstore_item_id = webstore_url.path().substr( |
175 webstore_base_url.path().length()); | 175 webstore_base_url.path().length()); |
176 if (!::Extension::IdIsValid(candidate_webstore_item_id)) { | 176 if (!extensions::Extension::IdIsValid(candidate_webstore_item_id)) { |
177 *error = kInvalidWebstoreItemUrlError; | 177 *error = kInvalidWebstoreItemUrlError; |
178 return false; | 178 return false; |
179 } | 179 } |
180 | 180 |
181 std::string reconstructed_webstore_item_url_string = | 181 std::string reconstructed_webstore_item_url_string = |
182 extension_urls::GetWebstoreItemDetailURLPrefix() + | 182 extension_urls::GetWebstoreItemDetailURLPrefix() + |
183 candidate_webstore_item_id; | 183 candidate_webstore_item_id; |
184 if (reconstructed_webstore_item_url_string != webstore_url_string) { | 184 if (reconstructed_webstore_item_url_string != webstore_url_string) { |
185 *error = kInvalidWebstoreItemUrlError; | 185 *error = kInvalidWebstoreItemUrlError; |
186 return false; | 186 return false; |
(...skipping 22 matching lines...) Expand all Loading... |
209 const std::string& error) { | 209 const std::string& error) { |
210 v8::HandleScope handle_scope; | 210 v8::HandleScope handle_scope; |
211 v8::Context::Scope context_scope(context_->v8_context()); | 211 v8::Context::Scope context_scope(context_->v8_context()); |
212 v8::Handle<v8::Value> argv[3]; | 212 v8::Handle<v8::Value> argv[3]; |
213 argv[0] = v8::Integer::New(install_id); | 213 argv[0] = v8::Integer::New(install_id); |
214 argv[1] = v8::Boolean::New(success); | 214 argv[1] = v8::Boolean::New(success); |
215 argv[2] = v8::String::New(error.c_str()); | 215 argv[2] = v8::String::New(error.c_str()); |
216 CHECK(context_->CallChromeHiddenMethod("webstore.onInstallResponse", | 216 CHECK(context_->CallChromeHiddenMethod("webstore.onInstallResponse", |
217 arraysize(argv), argv, NULL)); | 217 arraysize(argv), argv, NULL)); |
218 } | 218 } |
OLD | NEW |