| 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 16 matching lines...) Expand all Loading... |
| 27 #include "net/base/load_flags.h" | 27 #include "net/base/load_flags.h" |
| 28 #include "net/url_request/url_fetcher.h" | 28 #include "net/url_request/url_fetcher.h" |
| 29 #include "net/url_request/url_request_status.h" | 29 #include "net/url_request/url_request_status.h" |
| 30 | 30 |
| 31 using content::BrowserThread; | 31 using content::BrowserThread; |
| 32 using content::OpenURLParams; | 32 using content::OpenURLParams; |
| 33 using content::UtilityProcessHost; | 33 using content::UtilityProcessHost; |
| 34 using content::UtilityProcessHostClient; | 34 using content::UtilityProcessHostClient; |
| 35 using content::WebContents; | 35 using content::WebContents; |
| 36 | 36 |
| 37 namespace extensions { |
| 38 |
| 37 const char kManifestKey[] = "manifest"; | 39 const char kManifestKey[] = "manifest"; |
| 38 const char kIconUrlKey[] = "icon_url"; | 40 const char kIconUrlKey[] = "icon_url"; |
| 39 const char kLocalizedNameKey[] = "localized_name"; | 41 const char kLocalizedNameKey[] = "localized_name"; |
| 40 const char kLocalizedDescriptionKey[] = "localized_description"; | 42 const char kLocalizedDescriptionKey[] = "localized_description"; |
| 41 const char kUsersKey[] = "users"; | 43 const char kUsersKey[] = "users"; |
| 42 const char kAverageRatingKey[] = "average_rating"; | 44 const char kAverageRatingKey[] = "average_rating"; |
| 43 const char kRatingCountKey[] = "rating_count"; | 45 const char kRatingCountKey[] = "rating_count"; |
| 44 const char kVerifiedSiteKey[] = "verified_site"; | 46 const char kVerifiedSiteKey[] = "verified_site"; |
| 45 const char kInlineInstallNotSupportedKey[] = "inline_install_not_supported"; | 47 const char kInlineInstallNotSupportedKey[] = "inline_install_not_supported"; |
| 46 const char kRedirectUrlKey[] = "redirect_url"; | 48 const char kRedirectUrlKey[] = "redirect_url"; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 id_(webstore_item_id), | 159 id_(webstore_item_id), |
| 158 requestor_url_(requestor_url), | 160 requestor_url_(requestor_url), |
| 159 delegate_(delegate), | 161 delegate_(delegate), |
| 160 average_rating_(0.0), | 162 average_rating_(0.0), |
| 161 rating_count_(0) { | 163 rating_count_(0) { |
| 162 } | 164 } |
| 163 | 165 |
| 164 void WebstoreInlineInstaller::BeginInstall() { | 166 void WebstoreInlineInstaller::BeginInstall() { |
| 165 AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. | 167 AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. |
| 166 | 168 |
| 167 if (!extensions::Extension::IdIsValid(id_)) { | 169 if (!Extension::IdIsValid(id_)) { |
| 168 CompleteInstall(kInvalidWebstoreItemId); | 170 CompleteInstall(kInvalidWebstoreItemId); |
| 169 return; | 171 return; |
| 170 } | 172 } |
| 171 | 173 |
| 172 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); | 174 GURL webstore_data_url(extension_urls::GetWebstoreItemJsonDataURL(id_)); |
| 173 | 175 |
| 174 webstore_data_url_fetcher_.reset(net::URLFetcher::Create( | 176 webstore_data_url_fetcher_.reset(net::URLFetcher::Create( |
| 175 webstore_data_url, net::URLFetcher::GET, this)); | 177 webstore_data_url, net::URLFetcher::GET, this)); |
| 176 Profile* profile = Profile::FromBrowserContext( | 178 Profile* profile = Profile::FromBrowserContext( |
| 177 web_contents()->GetBrowserContext()); | 179 web_contents()->GetBrowserContext()); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 verified_site_pattern.Parse(verified_site_url); | 450 verified_site_pattern.Parse(verified_site_url); |
| 449 if (parse_result != URLPattern::PARSE_SUCCESS) { | 451 if (parse_result != URLPattern::PARSE_SUCCESS) { |
| 450 DLOG(WARNING) << "Could not parse " << verified_site_url << | 452 DLOG(WARNING) << "Could not parse " << verified_site_url << |
| 451 " as URL pattern " << parse_result; | 453 " as URL pattern " << parse_result; |
| 452 return false; | 454 return false; |
| 453 } | 455 } |
| 454 verified_site_pattern.SetScheme("*"); | 456 verified_site_pattern.SetScheme("*"); |
| 455 | 457 |
| 456 return verified_site_pattern.MatchesURL(requestor_url); | 458 return verified_site_pattern.MatchesURL(requestor_url); |
| 457 } | 459 } |
| 460 |
| 461 } // namespace extensions |
| OLD | NEW |