| 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 "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
| 16 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 17 #include "extensions/browser/extension_util.h" |
| 17 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 using content::WebContents; | 21 using content::WebContents; |
| 21 | 22 |
| 22 namespace extensions { | 23 namespace extensions { |
| 23 | 24 |
| 24 const char kInvalidWebstoreItemId[] = "Invalid Chrome Web Store item ID"; | 25 const char kInvalidWebstoreItemId[] = "Invalid Chrome Web Store item ID"; |
| 25 const char kWebstoreRequestError[] = | 26 const char kWebstoreRequestError[] = |
| 26 "Could not fetch data from the Chrome Web Store"; | 27 "Could not fetch data from the Chrome Web Store"; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 if (extension) { | 238 if (extension) { |
| 238 std::string install_result; // Empty string for install success. | 239 std::string install_result; // Empty string for install success. |
| 239 if (!extension_service->IsExtensionEnabled(id_)) { | 240 if (!extension_service->IsExtensionEnabled(id_)) { |
| 240 if (!ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) { | 241 if (!ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) { |
| 241 // If the extension is installed but disabled, and not blacklisted, | 242 // If the extension is installed but disabled, and not blacklisted, |
| 242 // enable it. | 243 // enable it. |
| 243 extension_service->EnableExtension(id_); | 244 extension_service->EnableExtension(id_); |
| 244 } else { // Don't install a blacklisted extension. | 245 } else { // Don't install a blacklisted extension. |
| 245 install_result = kExtensionIsBlacklisted; | 246 install_result = kExtensionIsBlacklisted; |
| 246 } | 247 } |
| 247 } else if (!extension->is_ephemeral()) { | 248 } else if (!util::IsEphemeralApp(extension->id(), profile_)) { |
| 248 // else extension is installed and enabled; no work to be done. | 249 // else extension is installed and enabled; no work to be done. |
| 249 CompleteInstall(install_result); | 250 CompleteInstall(install_result); |
| 250 return; | 251 return; |
| 251 } | 252 } |
| 252 | 253 |
| 253 // TODO(tmdiep): Optimize installation of ephemeral apps. For now we just | 254 // TODO(tmdiep): Optimize installation of ephemeral apps. For now we just |
| 254 // reinstall the app. | 255 // reinstall the app. |
| 255 } | 256 } |
| 256 | 257 |
| 257 scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval(); | 258 scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via | 327 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via |
| 327 // OnExtensionInstallSuccess or OnExtensionInstallFailure. | 328 // OnExtensionInstallSuccess or OnExtensionInstallFailure. |
| 328 AddRef(); | 329 AddRef(); |
| 329 | 330 |
| 330 install_ui_ = CreateInstallUI(); | 331 install_ui_ = CreateInstallUI(); |
| 331 install_ui_->ConfirmStandaloneInstall( | 332 install_ui_->ConfirmStandaloneInstall( |
| 332 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); | 333 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); |
| 333 } | 334 } |
| 334 | 335 |
| 335 } // namespace extensions | 336 } // namespace extensions |
| OLD | NEW |