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" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. | 164 AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. |
165 | 165 |
166 if (!extensions::Extension::IdIsValid(id_)) { | 166 if (!extensions::Extension::IdIsValid(id_)) { |
167 CompleteInstall(kInvalidWebstoreItemId); | 167 CompleteInstall(kInvalidWebstoreItemId); |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); | 171 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); |
172 | 172 |
173 webstore_data_url_fetcher_.reset(content::URLFetcher::Create( | 173 webstore_data_url_fetcher_.reset(content::URLFetcher::Create( |
174 webstore_data_url, content::URLFetcher::GET, this)); | 174 webstore_data_url, net::URLFetcher::GET, this)); |
175 Profile* profile = Profile::FromBrowserContext( | 175 Profile* profile = Profile::FromBrowserContext( |
176 web_contents()->GetBrowserContext()); | 176 web_contents()->GetBrowserContext()); |
177 webstore_data_url_fetcher_->SetRequestContext( | 177 webstore_data_url_fetcher_->SetRequestContext( |
178 profile->GetRequestContext()); | 178 profile->GetRequestContext()); |
179 // Use the requesting page as the referrer both since that is more correct | 179 // Use the requesting page as the referrer both since that is more correct |
180 // (it is the page that caused this request to happen) and so that we can | 180 // (it is the page that caused this request to happen) and so that we can |
181 // track top sites that trigger inline install requests. | 181 // track top sites that trigger inline install requests. |
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 | |
(...skipping 261 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 |