| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/unpacked_installer.h" | 5 #include "chrome/browser/extensions/unpacked_installer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.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_prefs.h" | 11 #include "chrome/browser/extensions/extension_prefs.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "chrome/common/extensions/extension_file_util.h" | 14 #include "chrome/common/extensions/extension_file_util.h" |
| 15 #include "chrome/common/string_ordinal.h" | |
| 16 | 15 |
| 17 using content::BrowserThread; | 16 using content::BrowserThread; |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 // Manages an ExtensionInstallUI for a particular extension. | 20 // Manages an ExtensionInstallUI for a particular extension. |
| 22 class SimpleExtensionLoadPrompt : public ExtensionInstallUI::Delegate { | 21 class SimpleExtensionLoadPrompt : public ExtensionInstallUI::Delegate { |
| 23 public: | 22 public: |
| 24 SimpleExtensionLoadPrompt(Profile* profile, | 23 SimpleExtensionLoadPrompt(Profile* profile, |
| 25 base::WeakPtr<ExtensionService> extension_service, | 24 base::WeakPtr<ExtensionService> extension_service, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 50 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { | 49 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { |
| 51 } | 50 } |
| 52 | 51 |
| 53 void SimpleExtensionLoadPrompt::ShowPrompt() { | 52 void SimpleExtensionLoadPrompt::ShowPrompt() { |
| 54 install_ui_->ConfirmInstall(this, extension_); | 53 install_ui_->ConfirmInstall(this, extension_); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void SimpleExtensionLoadPrompt::InstallUIProceed() { | 56 void SimpleExtensionLoadPrompt::InstallUIProceed() { |
| 58 if (service_weak_.get()) | 57 if (service_weak_.get()) |
| 59 service_weak_->OnExtensionInstalled( | 58 service_weak_->OnExtensionInstalled( |
| 60 extension_, false, StringOrdinal()); // Not from web store. | 59 extension_, false, -1); // Not from web store. |
| 61 delete this; | 60 delete this; |
| 62 } | 61 } |
| 63 | 62 |
| 64 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { | 63 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { |
| 65 delete this; | 64 delete this; |
| 66 } | 65 } |
| 67 | 66 |
| 68 } // namespace | 67 } // namespace |
| 69 | 68 |
| 70 namespace extensions { | 69 namespace extensions { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 disabled_extensions->Contains(extension->id())) { | 202 disabled_extensions->Contains(extension->id())) { |
| 204 SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt( | 203 SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt( |
| 205 service_weak_->profile(), | 204 service_weak_->profile(), |
| 206 service_weak_, | 205 service_weak_, |
| 207 extension); | 206 extension); |
| 208 prompt->ShowPrompt(); | 207 prompt->ShowPrompt(); |
| 209 return; // continues in SimpleExtensionLoadPrompt::InstallUI* | 208 return; // continues in SimpleExtensionLoadPrompt::InstallUI* |
| 210 } | 209 } |
| 211 service_weak_->OnExtensionInstalled(extension, | 210 service_weak_->OnExtensionInstalled(extension, |
| 212 false, // Not from web store. | 211 false, // Not from web store. |
| 213 StringOrdinal()); | 212 -1); |
| 214 } | 213 } |
| 215 | 214 |
| 216 } // namespace extensions | 215 } // namespace extensions |
| OLD | NEW |