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