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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, | 128 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, |
129 ExtensionInstallUI* client) | 129 ExtensionInstallUI* client) |
130 : install_directory_(frontend_weak->install_directory()), | 130 : install_directory_(frontend_weak->install_directory()), |
131 install_source_(Extension::INTERNAL), | 131 install_source_(Extension::INTERNAL), |
132 extensions_enabled_(frontend_weak->extensions_enabled()), | 132 extensions_enabled_(frontend_weak->extensions_enabled()), |
133 delete_source_(false), | 133 delete_source_(false), |
134 create_app_shortcut_(false), | 134 create_app_shortcut_(false), |
135 page_index_(-1), | |
136 frontend_weak_(frontend_weak), | 135 frontend_weak_(frontend_weak), |
137 profile_(frontend_weak->profile()), | 136 profile_(frontend_weak->profile()), |
138 client_(client), | 137 client_(client), |
139 apps_require_extension_mime_type_(false), | 138 apps_require_extension_mime_type_(false), |
140 allow_silent_install_(false), | 139 allow_silent_install_(false), |
141 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 140 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
142 creation_flags_(Extension::NO_FLAGS) { | 141 creation_flags_(Extension::NO_FLAGS) { |
143 } | 142 } |
144 | 143 |
145 CrxInstaller::~CrxInstaller() { | 144 CrxInstaller::~CrxInstaller() { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // We update the extension's granted permissions if the user already approved | 579 // We update the extension's granted permissions if the user already approved |
581 // the install (client_ is non NULL), or we are allowed to install this | 580 // the install (client_ is non NULL), or we are allowed to install this |
582 // silently. We only track granted permissions for INTERNAL extensions. | 581 // silently. We only track granted permissions for INTERNAL extensions. |
583 if ((client_ || allow_silent_install_) && | 582 if ((client_ || allow_silent_install_) && |
584 extension_->location() == Extension::INTERNAL) | 583 extension_->location() == Extension::INTERNAL) |
585 frontend_weak_->GrantPermissions(extension_); | 584 frontend_weak_->GrantPermissions(extension_); |
586 | 585 |
587 // Tell the frontend about the installation and hand off ownership of | 586 // Tell the frontend about the installation and hand off ownership of |
588 // extension_ to it. | 587 // extension_ to it. |
589 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), | 588 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), |
590 page_index_); | 589 page_ordinal_); |
591 | 590 |
592 NotifyCrxInstallComplete(extension_.get()); | 591 NotifyCrxInstallComplete(extension_.get()); |
593 | 592 |
594 extension_ = NULL; | 593 extension_ = NULL; |
595 | 594 |
596 // We're done. We don't post any more tasks to ourselves so we are deleted | 595 // We're done. We don't post any more tasks to ourselves so we are deleted |
597 // soon. | 596 // soon. |
598 } | 597 } |
599 | 598 |
600 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { | 599 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { |
601 // Some users (such as the download shelf) need to know when a | 600 // Some users (such as the download shelf) need to know when a |
602 // CRXInstaller is done. Listening for the EXTENSION_* events | 601 // CRXInstaller is done. Listening for the EXTENSION_* events |
603 // is problematic because they don't know anything about the | 602 // is problematic because they don't know anything about the |
604 // extension before it is unpacked, so they cannot filter based | 603 // extension before it is unpacked, so they cannot filter based |
605 // on the extension. | 604 // on the extension. |
606 content::NotificationService::current()->Notify( | 605 content::NotificationService::current()->Notify( |
607 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 606 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
608 content::Source<CrxInstaller>(this), | 607 content::Source<CrxInstaller>(this), |
609 content::Details<const Extension>(extension)); | 608 content::Details<const Extension>(extension)); |
610 } | 609 } |
OLD | NEW |