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/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/common/extensions/api/webstore/webstore_api_constants.h" | 8 #include "chrome/common/extensions/api/webstore/webstore_api_constants.h" |
9 #include "chrome/common/extensions/chrome_extension_messages.h" | 9 #include "chrome/common/extensions/chrome_extension_messages.h" |
10 #include "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 WebNode child = children.item(i); | 132 WebNode child = children.item(i); |
133 if (!child.isElementNode()) | 133 if (!child.isElementNode()) |
134 continue; | 134 continue; |
135 WebElement elem = child.to<WebElement>(); | 135 WebElement elem = child.to<WebElement>(); |
136 | 136 |
137 if (!elem.hasHTMLTagName("link") || !elem.hasAttribute("rel") || | 137 if (!elem.hasHTMLTagName("link") || !elem.hasAttribute("rel") || |
138 !elem.hasAttribute("href")) | 138 !elem.hasAttribute("href")) |
139 continue; | 139 continue; |
140 | 140 |
141 std::string rel = elem.getAttribute("rel").utf8(); | 141 std::string rel = elem.getAttribute("rel").utf8(); |
142 if (!base::LowerCaseEqualsASCII(rel, kWebstoreLinkRelation)) | 142 if (!LowerCaseEqualsASCII(rel, kWebstoreLinkRelation)) |
143 continue; | 143 continue; |
144 | 144 |
145 std::string webstore_url_string(elem.getAttribute("href").utf8()); | 145 std::string webstore_url_string(elem.getAttribute("href").utf8()); |
146 | 146 |
147 if (!preferred_store_link_url.empty() && | 147 if (!preferred_store_link_url.empty() && |
148 preferred_store_link_url != webstore_url_string) { | 148 preferred_store_link_url != webstore_url_string) { |
149 continue; | 149 continue; |
150 } | 150 } |
151 | 151 |
152 GURL webstore_url = GURL(webstore_url_string); | 152 GURL webstore_url = GURL(webstore_url_string); |
(...skipping 90 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::Handle<v8::Value> argv[] = { | 246 v8::Handle<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 |