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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 std::set<std::string> ids; | 51 std::set<std::string> ids; |
52 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries; | 52 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries; |
53 }; | 53 }; |
54 | 54 |
55 static base::LazyInstance<Whitelist> | 55 static base::LazyInstance<Whitelist> |
56 g_whitelisted_install_data(base::LINKER_INITIALIZED); | 56 g_whitelisted_install_data(base::LINKER_INITIALIZED); |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 CrxInstaller::WhitelistEntry::WhitelistEntry() | 60 CrxInstaller::WhitelistEntry::WhitelistEntry() |
61 : use_app_installed_bubble(false) {} | 61 : use_app_installed_bubble(false), |
| 62 skip_post_install_ui(false) {} |
62 CrxInstaller::WhitelistEntry::~WhitelistEntry() {} | 63 CrxInstaller::WhitelistEntry::~WhitelistEntry() {} |
63 | 64 |
64 // static | 65 // static |
65 scoped_refptr<CrxInstaller> CrxInstaller::Create( | 66 scoped_refptr<CrxInstaller> CrxInstaller::Create( |
66 ExtensionService* frontend, | 67 ExtensionService* frontend, |
67 ExtensionInstallUI* client) { | 68 ExtensionInstallUI* client) { |
68 return new CrxInstaller(frontend->AsWeakPtr(), client); | 69 return new CrxInstaller(frontend->AsWeakPtr(), client); |
69 } | 70 } |
70 | 71 |
71 // static | 72 // static |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 RemoveWhitelistEntry(extension_->id())); | 411 RemoveWhitelistEntry(extension_->id())); |
411 if (is_gallery_install() && entry.get() && original_manifest_.get()) { | 412 if (is_gallery_install() && entry.get() && original_manifest_.get()) { |
412 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) { | 413 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) { |
413 ReportFailureFromUIThread( | 414 ReportFailureFromUIThread( |
414 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID)); | 415 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID)); |
415 return; | 416 return; |
416 } | 417 } |
417 whitelisted = true; | 418 whitelisted = true; |
418 if (entry->use_app_installed_bubble) | 419 if (entry->use_app_installed_bubble) |
419 client_->set_use_app_installed_bubble(true); | 420 client_->set_use_app_installed_bubble(true); |
| 421 if (entry->skip_post_install_ui) |
| 422 client_->set_skip_post_install_ui(true); |
420 } | 423 } |
421 | 424 |
422 if (client_ && | 425 if (client_ && |
423 (!allow_silent_install_ || !whitelisted)) { | 426 (!allow_silent_install_ || !whitelisted)) { |
424 AddRef(); // Balanced in Proceed() and Abort(). | 427 AddRef(); // Balanced in Proceed() and Abort(). |
425 client_->ConfirmInstall(this, extension_.get()); | 428 client_->ConfirmInstall(this, extension_.get()); |
426 } else { | 429 } else { |
427 if (!BrowserThread::PostTask( | 430 if (!BrowserThread::PostTask( |
428 BrowserThread::FILE, FROM_HERE, | 431 BrowserThread::FILE, FROM_HERE, |
429 base::Bind(&CrxInstaller::CompleteInstall, this))) | 432 base::Bind(&CrxInstaller::CompleteInstall, this))) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // Some users (such as the download shelf) need to know when a | 599 // Some users (such as the download shelf) need to know when a |
597 // CRXInstaller is done. Listening for the EXTENSION_* events | 600 // CRXInstaller is done. Listening for the EXTENSION_* events |
598 // is problematic because they don't know anything about the | 601 // is problematic because they don't know anything about the |
599 // extension before it is unpacked, so they can not filter based | 602 // extension before it is unpacked, so they can not filter based |
600 // on the extension. | 603 // on the extension. |
601 content::NotificationService::current()->Notify( | 604 content::NotificationService::current()->Notify( |
602 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 605 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
603 content::Source<CrxInstaller>(this), | 606 content::Source<CrxInstaller>(this), |
604 content::NotificationService::NoDetails()); | 607 content::NotificationService::NoDetails()); |
605 } | 608 } |
OLD | NEW |