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/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 "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 #include "chrome/browser/extensions/extension_install_prompt.h" | 11 #include "chrome/browser/extensions/extension_install_prompt.h" |
12 #include "chrome/browser/extensions/extension_install_ui.h" | 12 #include "chrome/browser/extensions/extension_install_ui.h" |
13 #include "chrome/browser/extensions/extension_prefs.h" | 13 #include "chrome/browser/extensions/extension_prefs.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/permissions_updater.h" | 15 #include "chrome/browser/extensions/permissions_updater.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/extensions/extension_file_util.h" | 17 #include "chrome/common/extensions/extension_file_util.h" |
18 #include "chrome/common/string_ordinal.h" | 18 #include "sync/api/string_ordinal.h" |
19 | 19 |
20 using content::BrowserThread; | 20 using content::BrowserThread; |
21 using extensions::Extension; | 21 using extensions::Extension; |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 const char kUnpackedExtensionsBlacklistedError[] = | 25 const char kUnpackedExtensionsBlacklistedError[] = |
26 "Loading of unpacked extensions is disabled by the administrator."; | 26 "Loading of unpacked extensions is disabled by the administrator."; |
27 | 27 |
28 // Manages an ExtensionInstallPrompt for a particular extension. | 28 // Manages an ExtensionInstallPrompt for a particular extension. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 void SimpleExtensionLoadPrompt::ShowPrompt() { | 61 void SimpleExtensionLoadPrompt::ShowPrompt() { |
62 install_ui_->ConfirmInstall(this, extension_); | 62 install_ui_->ConfirmInstall(this, extension_); |
63 } | 63 } |
64 | 64 |
65 void SimpleExtensionLoadPrompt::InstallUIProceed() { | 65 void SimpleExtensionLoadPrompt::InstallUIProceed() { |
66 if (service_weak_.get()) { | 66 if (service_weak_.get()) { |
67 extensions::PermissionsUpdater perms_updater(service_weak_->profile()); | 67 extensions::PermissionsUpdater perms_updater(service_weak_->profile()); |
68 perms_updater.GrantActivePermissions(extension_, false); | 68 perms_updater.GrantActivePermissions(extension_, false); |
69 service_weak_->OnExtensionInstalled( | 69 service_weak_->OnExtensionInstalled( |
70 extension_, false, StringOrdinal()); // Not from web store. | 70 extension_, false, syncer::StringOrdinal()); // Not from web store. |
71 } | 71 } |
72 delete this; | 72 delete this; |
73 } | 73 } |
74 | 74 |
75 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { | 75 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { |
76 delete this; | 76 delete this; |
77 } | 77 } |
78 | 78 |
79 } // namespace | 79 } // namespace |
80 | 80 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 service_weak_, | 230 service_weak_, |
231 extension); | 231 extension); |
232 prompt->ShowPrompt(); | 232 prompt->ShowPrompt(); |
233 return; // continues in SimpleExtensionLoadPrompt::InstallPrompt* | 233 return; // continues in SimpleExtensionLoadPrompt::InstallPrompt* |
234 } | 234 } |
235 | 235 |
236 PermissionsUpdater perms_updater(service_weak_->profile()); | 236 PermissionsUpdater perms_updater(service_weak_->profile()); |
237 perms_updater.GrantActivePermissions(extension, false); | 237 perms_updater.GrantActivePermissions(extension, false); |
238 service_weak_->OnExtensionInstalled(extension, | 238 service_weak_->OnExtensionInstalled(extension, |
239 false, // Not from web store. | 239 false, // Not from web store. |
240 StringOrdinal()); | 240 syncer::StringOrdinal()); |
241 } | 241 } |
242 | 242 |
243 } // namespace extensions | 243 } // namespace extensions |
OLD | NEW |