| 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_standalone_installer.h" | 5 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/webstore_data_fetcher.h" | 12 #include "chrome/browser/extensions/webstore_data_fetcher.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "extensions/common/extension_urls.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 using content::WebContents; | 19 using content::WebContents; |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 | 22 |
| 22 const char kManifestKey[] = "manifest"; | 23 const char kManifestKey[] = "manifest"; |
| 23 const char kIconUrlKey[] = "icon_url"; | 24 const char kIconUrlKey[] = "icon_url"; |
| 24 const char kLocalizedNameKey[] = "localized_name"; | 25 const char kLocalizedNameKey[] = "localized_name"; |
| 25 const char kLocalizedDescriptionKey[] = "localized_description"; | 26 const char kLocalizedDescriptionKey[] = "localized_description"; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 | 139 |
| 139 // Icon URL is optional. | 140 // Icon URL is optional. |
| 140 GURL icon_url; | 141 GURL icon_url; |
| 141 if (webstore_data->HasKey(kIconUrlKey)) { | 142 if (webstore_data->HasKey(kIconUrlKey)) { |
| 142 std::string icon_url_string; | 143 std::string icon_url_string; |
| 143 if (!webstore_data->GetString(kIconUrlKey, &icon_url_string)) { | 144 if (!webstore_data->GetString(kIconUrlKey, &icon_url_string)) { |
| 144 CompleteInstall(kInvalidWebstoreResponseError); | 145 CompleteInstall(kInvalidWebstoreResponseError); |
| 145 return; | 146 return; |
| 146 } | 147 } |
| 147 icon_url = GURL(extension_urls::GetWebstoreLaunchURL()).Resolve( | 148 icon_url = GURL(GetWebstoreLaunchURL()).Resolve(icon_url_string); |
| 148 icon_url_string); | |
| 149 if (!icon_url.is_valid()) { | 149 if (!icon_url.is_valid()) { |
| 150 CompleteInstall(kInvalidWebstoreResponseError); | 150 CompleteInstall(kInvalidWebstoreResponseError); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Assume ownership of webstore_data. | 155 // Assume ownership of webstore_data. |
| 156 webstore_data_ = webstore_data.Pass(); | 156 webstore_data_ = webstore_data.Pass(); |
| 157 | 157 |
| 158 scoped_refptr<WebstoreInstallHelper> helper = | 158 scoped_refptr<WebstoreInstallHelper> helper = |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via | 287 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via |
| 288 // OnExtensionInstallSuccess or OnExtensionInstallFailure. | 288 // OnExtensionInstallSuccess or OnExtensionInstallFailure. |
| 289 AddRef(); | 289 AddRef(); |
| 290 | 290 |
| 291 install_ui_ = CreateInstallUI(); | 291 install_ui_ = CreateInstallUI(); |
| 292 install_ui_->ConfirmStandaloneInstall( | 292 install_ui_->ConfirmStandaloneInstall( |
| 293 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); | 293 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace extensions | 296 } // namespace extensions |
| OLD | NEW |