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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, | 115 CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, |
116 ExtensionInstallUI* client) | 116 ExtensionInstallUI* client) |
117 : install_directory_(frontend_weak->install_directory()), | 117 : install_directory_(frontend_weak->install_directory()), |
118 install_source_(Extension::INTERNAL), | 118 install_source_(Extension::INTERNAL), |
119 extensions_enabled_(frontend_weak->extensions_enabled()), | 119 extensions_enabled_(frontend_weak->extensions_enabled()), |
120 delete_source_(false), | 120 delete_source_(false), |
121 is_gallery_install_(false), | 121 is_gallery_install_(false), |
122 create_app_shortcut_(false), | 122 create_app_shortcut_(false), |
| 123 page_index_(0), |
123 frontend_weak_(frontend_weak), | 124 frontend_weak_(frontend_weak), |
124 client_(client), | 125 client_(client), |
125 apps_require_extension_mime_type_(false), | 126 apps_require_extension_mime_type_(false), |
126 allow_silent_install_(false), | 127 allow_silent_install_(false), |
127 install_cause_(extension_misc::INSTALL_CAUSE_UNSET) { | 128 install_cause_(extension_misc::INSTALL_CAUSE_UNSET) { |
128 } | 129 } |
129 | 130 |
130 CrxInstaller::~CrxInstaller() { | 131 CrxInstaller::~CrxInstaller() { |
131 // Delete the temp directory and crx file as necessary. Note that the | 132 // Delete the temp directory and crx file as necessary. Note that the |
132 // destructor might be called on any thread, so we post a task to the file | 133 // destructor might be called on any thread, so we post a task to the file |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 557 |
557 // We update the extension's granted permissions if the user already approved | 558 // We update the extension's granted permissions if the user already approved |
558 // the install (client_ is non NULL), or we are allowed to install this | 559 // the install (client_ is non NULL), or we are allowed to install this |
559 // silently. We only track granted permissions for INTERNAL extensions. | 560 // silently. We only track granted permissions for INTERNAL extensions. |
560 if ((client_ || allow_silent_install_) && | 561 if ((client_ || allow_silent_install_) && |
561 extension_->location() == Extension::INTERNAL) | 562 extension_->location() == Extension::INTERNAL) |
562 frontend_weak_->GrantPermissions(extension_); | 563 frontend_weak_->GrantPermissions(extension_); |
563 | 564 |
564 // Tell the frontend about the installation and hand off ownership of | 565 // Tell the frontend about the installation and hand off ownership of |
565 // extension_ to it. | 566 // extension_ to it. |
566 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install()); | 567 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), |
| 568 page_index_); |
567 extension_ = NULL; | 569 extension_ = NULL; |
568 | 570 |
569 NotifyCrxInstallComplete(); | 571 NotifyCrxInstallComplete(); |
570 | 572 |
571 // We're done. We don't post any more tasks to ourselves so we are deleted | 573 // We're done. We don't post any more tasks to ourselves so we are deleted |
572 // soon. | 574 // soon. |
573 } | 575 } |
574 | 576 |
575 void CrxInstaller::NotifyCrxInstallComplete() { | 577 void CrxInstaller::NotifyCrxInstallComplete() { |
576 // Some users (such as the download shelf) need to know when a | 578 // Some users (such as the download shelf) need to know when a |
577 // CRXInstaller is done. Listening for the EXTENSION_* events | 579 // CRXInstaller is done. Listening for the EXTENSION_* events |
578 // is problematic because they don't know anything about the | 580 // is problematic because they don't know anything about the |
579 // extension before it is unpacked, so they can not filter based | 581 // extension before it is unpacked, so they can not filter based |
580 // on the extension. | 582 // on the extension. |
581 NotificationService::current()->Notify( | 583 NotificationService::current()->Notify( |
582 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 584 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
583 Source<CrxInstaller>(this), | 585 Source<CrxInstaller>(this), |
584 NotificationService::NoDetails()); | 586 NotificationService::NoDetails()); |
585 } | 587 } |
OLD | NEW |