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/browser/extensions/webstore_inline_installer.h" | 5 #include "chrome/browser/extensions/webstore_inline_installer.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/extensions/crx_installer.h" | 13 #include "chrome/browser/extensions/crx_installer.h" |
14 #include "chrome/browser/extensions/extension_install_dialog.h" | 14 #include "chrome/browser/extensions/extension_install_dialog.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/common/chrome_utility_messages.h" | 17 #include "chrome/common/chrome_utility_messages.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "chrome/common/extensions/extension_constants.h" | 19 #include "chrome/common/extensions/extension_constants.h" |
20 #include "chrome/common/extensions/url_pattern.h" | 20 #include "chrome/common/extensions/url_pattern.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "content/public/browser/web_contents.h" | |
23 #include "content/public/browser/utility_process_host.h" | 22 #include "content/public/browser/utility_process_host.h" |
24 #include "content/public/browser/utility_process_host_client.h" | 23 #include "content/public/browser/utility_process_host_client.h" |
| 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/url_fetcher.h" | 25 #include "content/public/common/url_fetcher.h" |
26 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
27 #include "net/base/load_flags.h" | 27 #include "net/base/load_flags.h" |
28 #include "net/url_request/url_request_status.h" | 28 #include "net/url_request/url_request_status.h" |
29 | 29 |
30 using content::BrowserThread; | 30 using content::BrowserThread; |
31 using content::OpenURLParams; | 31 using content::OpenURLParams; |
32 using content::UtilityProcessHost; | 32 using content::UtilityProcessHost; |
33 using content::UtilityProcessHostClient; | 33 using content::UtilityProcessHostClient; |
34 using content::WebContents; | 34 using content::WebContents; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 webstore_data_url_fetcher_->SetReferrer(requestor_url_.spec()); | 182 webstore_data_url_fetcher_->SetReferrer(requestor_url_.spec()); |
183 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 183 webstore_data_url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
184 net::LOAD_DO_NOT_SAVE_COOKIES | | 184 net::LOAD_DO_NOT_SAVE_COOKIES | |
185 net::LOAD_DISABLE_CACHE); | 185 net::LOAD_DISABLE_CACHE); |
186 webstore_data_url_fetcher_->Start(); | 186 webstore_data_url_fetcher_->Start(); |
187 } | 187 } |
188 | 188 |
189 WebstoreInlineInstaller::~WebstoreInlineInstaller() {} | 189 WebstoreInlineInstaller::~WebstoreInlineInstaller() {} |
190 | 190 |
191 void WebstoreInlineInstaller::OnURLFetchComplete( | 191 void WebstoreInlineInstaller::OnURLFetchComplete( |
192 const content::URLFetcher* source) { | 192 const net::URLFetcher* source) { |
193 CHECK_EQ(webstore_data_url_fetcher_.get(), source); | 193 CHECK_EQ(webstore_data_url_fetcher_.get(), source); |
194 // We shouldn't be getting UrlFetcher callbacks if the WebContents has gone | 194 // We shouldn't be getting UrlFetcher callbacks if the WebContents has gone |
195 // away; we stop any in in-progress fetches in WebContentsDestroyed. | 195 // away; we stop any in in-progress fetches in WebContentsDestroyed. |
196 CHECK(web_contents()); | 196 CHECK(web_contents()); |
197 | 197 |
198 if (!webstore_data_url_fetcher_->GetStatus().is_success() || | 198 if (!webstore_data_url_fetcher_->GetStatus().is_success() || |
199 webstore_data_url_fetcher_->GetResponseCode() != 200) { | 199 webstore_data_url_fetcher_->GetResponseCode() != 200) { |
200 CompleteInstall(kWebstoreRequestError); | 200 CompleteInstall(kWebstoreRequestError); |
201 return; | 201 return; |
202 } | 202 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 verified_site_pattern.Parse(verified_site_url); | 446 verified_site_pattern.Parse(verified_site_url); |
447 if (parse_result != URLPattern::PARSE_SUCCESS) { | 447 if (parse_result != URLPattern::PARSE_SUCCESS) { |
448 DLOG(WARNING) << "Could not parse " << verified_site_url << | 448 DLOG(WARNING) << "Could not parse " << verified_site_url << |
449 " as URL pattern " << parse_result; | 449 " as URL pattern " << parse_result; |
450 return false; | 450 return false; |
451 } | 451 } |
452 verified_site_pattern.SetScheme("*"); | 452 verified_site_pattern.SetScheme("*"); |
453 | 453 |
454 return verified_site_pattern.MatchesURL(requestor_url); | 454 return verified_site_pattern.MatchesURL(requestor_url); |
455 } | 455 } |
OLD | NEW |