Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 10702017: Revert r 144574 "Modify experimental identity flow to display scope descriptions and details." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 delete_source_(false), 92 delete_source_(false),
93 create_app_shortcut_(false), 93 create_app_shortcut_(false),
94 frontend_weak_(frontend_weak), 94 frontend_weak_(frontend_weak),
95 profile_(frontend_weak->profile()), 95 profile_(frontend_weak->profile()),
96 client_(client), 96 client_(client),
97 apps_require_extension_mime_type_(false), 97 apps_require_extension_mime_type_(false),
98 allow_silent_install_(false), 98 allow_silent_install_(false),
99 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), 99 install_cause_(extension_misc::INSTALL_CAUSE_UNSET),
100 creation_flags_(Extension::NO_FLAGS), 100 creation_flags_(Extension::NO_FLAGS),
101 off_store_install_allow_reason_(OffStoreInstallDisallowed), 101 off_store_install_allow_reason_(OffStoreInstallDisallowed),
102 did_handle_successfully_(true), 102 did_handle_successfully_(true) {
103 record_oauth2_grant_(false) {
104 if (!approval) 103 if (!approval)
105 return; 104 return;
106 105
107 CHECK(profile_->IsSameProfile(approval->profile)); 106 CHECK(profile_->IsSameProfile(approval->profile));
108 client_->install_ui()->SetUseAppInstalledBubble( 107 client_->install_ui()->SetUseAppInstalledBubble(
109 approval->use_app_installed_bubble); 108 approval->use_app_installed_bubble);
110 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui); 109 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui);
111 110
112 if (approval->skip_install_dialog) { 111 if (approval->skip_install_dialog) {
113 // Mark the extension as approved, but save the expected manifest and ID 112 // Mark the extension as approved, but save the expected manifest and ID
114 // so we can check that they match the CRX's. 113 // so we can check that they match the CRX's.
115 approved_ = true; 114 approved_ = true;
116 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); 115 expected_manifest_.reset(approval->parsed_manifest->DeepCopy());
117 expected_id_ = approval->extension_id; 116 expected_id_ = approval->extension_id;
118 record_oauth2_grant_ = approval->record_oauth2_grant;
119 } 117 }
120 } 118 }
121 119
122 CrxInstaller::~CrxInstaller() { 120 CrxInstaller::~CrxInstaller() {
123 // Delete the temp directory and crx file as necessary. Note that the 121 // Delete the temp directory and crx file as necessary. Note that the
124 // destructor might be called on any thread, so we post a task to the file 122 // destructor might be called on any thread, so we post a task to the file
125 // thread to make sure the delete happens there. This is a best effort 123 // thread to make sure the delete happens there. This is a best effort
126 // operation since the browser can be shutting down so there might not 124 // operation since the browser can be shutting down so there might not
127 // be a file thread to post to. 125 // be a file thread to post to.
128 if (!temp_dir_.value().empty()) { 126 if (!temp_dir_.value().empty()) {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
583 581
584 if (!frontend_weak_.get()) 582 if (!frontend_weak_.get())
585 return; 583 return;
586 584
587 // If there is a client, tell the client about installation. 585 // If there is a client, tell the client about installation.
588 if (client_) { 586 if (client_) {
589 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); 587 client_->OnInstallSuccess(extension_.get(), install_icon_.get());
590 } 588 }
591 589
592 if (client_ && !approved_)
593 record_oauth2_grant_ = client_->record_oauth2_grant();
594
595 // We update the extension's granted permissions if the user already approved 590 // We update the extension's granted permissions if the user already approved
596 // the install (client_ is non NULL), or we are allowed to install this 591 // the install (client_ is non NULL), or we are allowed to install this
597 // silently. 592 // silently.
598 if (client_ || allow_silent_install_) { 593 if (client_ || allow_silent_install_) {
599 PermissionsUpdater perms_updater(profile()); 594 PermissionsUpdater perms_updater(profile());
600 perms_updater.GrantActivePermissions(extension_, record_oauth2_grant_); 595 perms_updater.GrantActivePermissions(extension_);
601 } 596 }
602 597
603 // Tell the frontend about the installation and hand off ownership of 598 // Tell the frontend about the installation and hand off ownership of
604 // extension_ to it. 599 // extension_ to it.
605 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), 600 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(),
606 page_ordinal_); 601 page_ordinal_);
607 602
608 NotifyCrxInstallComplete(extension_.get()); 603 NotifyCrxInstallComplete(extension_.get());
609 604
610 extension_ = NULL; 605 extension_ = NULL;
611 606
612 // We're done. We don't post any more tasks to ourselves so we are deleted 607 // We're done. We don't post any more tasks to ourselves so we are deleted
613 // soon. 608 // soon.
614 } 609 }
615 610
616 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { 611 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) {
617 // Some users (such as the download shelf) need to know when a 612 // Some users (such as the download shelf) need to know when a
618 // CRXInstaller is done. Listening for the EXTENSION_* events 613 // CRXInstaller is done. Listening for the EXTENSION_* events
619 // is problematic because they don't know anything about the 614 // is problematic because they don't know anything about the
620 // extension before it is unpacked, so they cannot filter based 615 // extension before it is unpacked, so they cannot filter based
621 // on the extension. 616 // on the extension.
622 content::NotificationService::current()->Notify( 617 content::NotificationService::current()->Notify(
623 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 618 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
624 content::Source<CrxInstaller>(this), 619 content::Source<CrxInstaller>(this),
625 content::Details<const Extension>(extension)); 620 content::Details<const Extension>(extension));
626 } 621 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/crx_installer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698