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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 Whitelist() {} | 45 Whitelist() {} |
46 std::set<std::string> ids; | 46 std::set<std::string> ids; |
47 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries; | 47 std::map<std::string, linked_ptr<CrxInstaller::WhitelistEntry> > entries; |
48 }; | 48 }; |
49 | 49 |
50 static base::LazyInstance<Whitelist> | 50 static base::LazyInstance<Whitelist> |
51 g_whitelisted_install_data(base::LINKER_INITIALIZED); | 51 g_whitelisted_install_data(base::LINKER_INITIALIZED); |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 CrxInstaller::WhitelistEntry::WhitelistEntry() {} | 55 CrxInstaller::WhitelistEntry::WhitelistEntry() |
| 56 : use_app_installed_bubble(false) {} |
56 CrxInstaller::WhitelistEntry::~WhitelistEntry() {} | 57 CrxInstaller::WhitelistEntry::~WhitelistEntry() {} |
57 | 58 |
58 // static | 59 // static |
59 void CrxInstaller::SetWhitelistedInstallId(const std::string& id) { | 60 void CrxInstaller::SetWhitelistedInstallId(const std::string& id) { |
60 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 61 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
61 g_whitelisted_install_data.Get().ids.insert(id); | 62 g_whitelisted_install_data.Get().ids.insert(id); |
62 } | 63 } |
63 | 64 |
64 // static | 65 // static |
65 void CrxInstaller::SetWhitelistEntry(const std::string& id, | 66 void CrxInstaller::SetWhitelistEntry(const std::string& id, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 bool whitelisted = false; | 400 bool whitelisted = false; |
400 scoped_ptr<CrxInstaller::WhitelistEntry> entry( | 401 scoped_ptr<CrxInstaller::WhitelistEntry> entry( |
401 RemoveWhitelistEntry(extension_->id())); | 402 RemoveWhitelistEntry(extension_->id())); |
402 if (is_gallery_install_ && entry.get() && original_manifest_.get()) { | 403 if (is_gallery_install_ && entry.get() && original_manifest_.get()) { |
403 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) { | 404 if (!(original_manifest_->Equals(entry->parsed_manifest.get()))) { |
404 ReportFailureFromUIThread( | 405 ReportFailureFromUIThread( |
405 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID)); | 406 l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_INVALID)); |
406 return; | 407 return; |
407 } | 408 } |
408 whitelisted = true; | 409 whitelisted = true; |
| 410 if (entry->use_app_installed_bubble) |
| 411 client_->set_use_app_installed_bubble(true); |
409 } | 412 } |
410 | 413 |
411 if (client_ && | 414 if (client_ && |
412 (!allow_silent_install_ || !whitelisted)) { | 415 (!allow_silent_install_ || !whitelisted)) { |
413 AddRef(); // Balanced in Proceed() and Abort(). | 416 AddRef(); // Balanced in Proceed() and Abort(). |
414 client_->ConfirmInstall(this, extension_.get()); | 417 client_->ConfirmInstall(this, extension_.get()); |
415 } else { | 418 } else { |
416 if (!BrowserThread::PostTask( | 419 if (!BrowserThread::PostTask( |
417 BrowserThread::FILE, FROM_HERE, | 420 BrowserThread::FILE, FROM_HERE, |
418 NewRunnableMethod(this, &CrxInstaller::CompleteInstall))) | 421 NewRunnableMethod(this, &CrxInstaller::CompleteInstall))) |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // Some users (such as the download shelf) need to know when a | 576 // Some users (such as the download shelf) need to know when a |
574 // CRXInstaller is done. Listening for the EXTENSION_* events | 577 // CRXInstaller is done. Listening for the EXTENSION_* events |
575 // is problematic because they don't know anything about the | 578 // is problematic because they don't know anything about the |
576 // extension before it is unpacked, so they can not filter based | 579 // extension before it is unpacked, so they can not filter based |
577 // on the extension. | 580 // on the extension. |
578 NotificationService::current()->Notify( | 581 NotificationService::current()->Notify( |
579 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 582 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
580 Source<CrxInstaller>(this), | 583 Source<CrxInstaller>(this), |
581 NotificationService::NoDetails()); | 584 NotificationService::NoDetails()); |
582 } | 585 } |
OLD | NEW |