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

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

Issue 10630021: Modify experimental identity flow to display scope descriptions and details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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) {
103 if (!approval) 104 if (!approval)
104 return; 105 return;
105 106
106 CHECK(profile_->IsSameProfile(approval->profile)); 107 CHECK(profile_->IsSameProfile(approval->profile));
107 client_->install_ui()->SetUseAppInstalledBubble( 108 client_->install_ui()->SetUseAppInstalledBubble(
108 approval->use_app_installed_bubble); 109 approval->use_app_installed_bubble);
109 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui); 110 client_->install_ui()->SetSkipPostInstallUI(approval->skip_post_install_ui);
110 111
111 if (approval->skip_install_dialog) { 112 if (approval->skip_install_dialog) {
112 // Mark the extension as approved, but save the expected manifest and ID 113 // Mark the extension as approved, but save the expected manifest and ID
113 // so we can check that they match the CRX's. 114 // so we can check that they match the CRX's.
114 approved_ = true; 115 approved_ = true;
115 expected_manifest_.reset(approval->parsed_manifest->DeepCopy()); 116 expected_manifest_.reset(approval->parsed_manifest->DeepCopy());
116 expected_id_ = approval->extension_id; 117 expected_id_ = approval->extension_id;
118 record_oauth2_grant_ = approval->record_oauth2_grant;
117 } 119 }
118 } 120 }
119 121
120 CrxInstaller::~CrxInstaller() { 122 CrxInstaller::~CrxInstaller() {
121 // Delete the temp directory and crx file as necessary. Note that the 123 // Delete the temp directory and crx file as necessary. Note that the
122 // destructor might be called on any thread, so we post a task to the file 124 // destructor might be called on any thread, so we post a task to the file
123 // thread to make sure the delete happens there. This is a best effort 125 // thread to make sure the delete happens there. This is a best effort
124 // operation since the browser can be shutting down so there might not 126 // operation since the browser can be shutting down so there might not
125 // be a file thread to post to. 127 // be a file thread to post to.
126 if (!temp_dir_.value().empty()) { 128 if (!temp_dir_.value().empty()) {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 582 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
581 583
582 if (!frontend_weak_.get()) 584 if (!frontend_weak_.get())
583 return; 585 return;
584 586
585 // If there is a client, tell the client about installation. 587 // If there is a client, tell the client about installation.
586 if (client_) { 588 if (client_) {
587 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); 589 client_->OnInstallSuccess(extension_.get(), install_icon_.get());
588 } 590 }
589 591
592 if (client_ && !approved_)
593 record_oauth2_grant_ = client_->record_oauth2_grant();
594
590 // We update the extension's granted permissions if the user already approved 595 // We update the extension's granted permissions if the user already approved
591 // the install (client_ is non NULL), or we are allowed to install this 596 // the install (client_ is non NULL), or we are allowed to install this
592 // silently. 597 // silently.
593 if (client_ || allow_silent_install_) { 598 if (client_ || allow_silent_install_) {
594 PermissionsUpdater perms_updater(profile()); 599 PermissionsUpdater perms_updater(profile());
595 perms_updater.GrantActivePermissions(extension_); 600 perms_updater.GrantActivePermissions(extension_, record_oauth2_grant_);
596 } 601 }
597 602
598 // Tell the frontend about the installation and hand off ownership of 603 // Tell the frontend about the installation and hand off ownership of
599 // extension_ to it. 604 // extension_ to it.
600 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), 605 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(),
601 page_ordinal_); 606 page_ordinal_);
602 607
603 NotifyCrxInstallComplete(extension_.get()); 608 NotifyCrxInstallComplete(extension_.get());
604 609
605 extension_ = NULL; 610 extension_ = NULL;
606 611
607 // We're done. We don't post any more tasks to ourselves so we are deleted 612 // We're done. We don't post any more tasks to ourselves so we are deleted
608 // soon. 613 // soon.
609 } 614 }
610 615
611 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { 616 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) {
612 // Some users (such as the download shelf) need to know when a 617 // Some users (such as the download shelf) need to know when a
613 // CRXInstaller is done. Listening for the EXTENSION_* events 618 // CRXInstaller is done. Listening for the EXTENSION_* events
614 // is problematic because they don't know anything about the 619 // is problematic because they don't know anything about the
615 // extension before it is unpacked, so they cannot filter based 620 // extension before it is unpacked, so they cannot filter based
616 // on the extension. 621 // on the extension.
617 content::NotificationService::current()->Notify( 622 content::NotificationService::current()->Notify(
618 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 623 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
619 content::Source<CrxInstaller>(this), 624 content::Source<CrxInstaller>(this),
620 content::Details<const Extension>(extension)); 625 content::Details<const Extension>(extension));
621 } 626 }
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