OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/scoped_temp_dir.h" | 14 #include "base/scoped_temp_dir.h" |
15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "base/task.h" | 18 #include "base/task.h" |
19 #include "base/thread_restrictions.h" | 19 #include "base/thread_restrictions.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "base/version.h" | 21 #include "base/version.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/browser_thread.h" | 23 #include "chrome/browser/browser_thread.h" |
24 #include "chrome/browser/extensions/convert_user_script.h" | 24 #include "chrome/browser/extensions/convert_user_script.h" |
25 #include "chrome/browser/extensions/convert_web_app.h" | 25 #include "chrome/browser/extensions/convert_web_app.h" |
26 #include "chrome/browser/extensions/extensions_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
27 #include "chrome/browser/extensions/extension_error_reporter.h" | 27 #include "chrome/browser/extensions/extension_error_reporter.h" |
28 #include "chrome/browser/shell_integration.h" | 28 #include "chrome/browser/shell_integration.h" |
29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/extensions/extension_file_util.h" | 31 #include "chrome/common/extensions/extension_file_util.h" |
32 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
33 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
34 #include "chrome/common/notification_type.h" | 34 #include "chrome/common/notification_type.h" |
35 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool CrxInstaller::ClearWhitelistedInstallId(const std::string& id) { | 72 bool CrxInstaller::ClearWhitelistedInstallId(const std::string& id) { |
73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
74 std::set<std::string>& ids = g_whitelisted_install_data.Get().ids; | 74 std::set<std::string>& ids = g_whitelisted_install_data.Get().ids; |
75 if (ContainsKey(ids, id)) { | 75 if (ContainsKey(ids, id)) { |
76 ids.erase(id); | 76 ids.erase(id); |
77 return true; | 77 return true; |
78 } | 78 } |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 CrxInstaller::CrxInstaller(ExtensionsService* frontend, | 82 CrxInstaller::CrxInstaller(ExtensionService* frontend, |
83 ExtensionInstallUI* client) | 83 ExtensionInstallUI* client) |
84 : install_directory_(frontend->install_directory()), | 84 : install_directory_(frontend->install_directory()), |
85 install_source_(Extension::INTERNAL), | 85 install_source_(Extension::INTERNAL), |
86 extensions_enabled_(frontend->extensions_enabled()), | 86 extensions_enabled_(frontend->extensions_enabled()), |
87 delete_source_(false), | 87 delete_source_(false), |
88 is_gallery_install_(false), | 88 is_gallery_install_(false), |
89 create_app_shortcut_(false), | 89 create_app_shortcut_(false), |
90 frontend_(frontend), | 90 frontend_(frontend), |
91 client_(client), | 91 client_(client), |
92 apps_require_extension_mime_type_(false), | 92 apps_require_extension_mime_type_(false), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); | 433 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); |
434 | 434 |
435 // Tell the frontend about the installation and hand off ownership of | 435 // Tell the frontend about the installation and hand off ownership of |
436 // extension_ to it. | 436 // extension_ to it. |
437 frontend_->OnExtensionInstalled(extension_); | 437 frontend_->OnExtensionInstalled(extension_); |
438 extension_ = NULL; | 438 extension_ = NULL; |
439 | 439 |
440 // We're done. We don't post any more tasks to ourselves so we are deleted | 440 // We're done. We don't post any more tasks to ourselves so we are deleted |
441 // soon. | 441 // soon. |
442 } | 442 } |
OLD | NEW |