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

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

Issue 9222013: Prevent unnecessary prompts when unpacked extensions use chrome.permissions.request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reword comment Created 8 years, 11 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 576
577 if (!frontend_weak_.get()) 577 if (!frontend_weak_.get())
578 return; 578 return;
579 579
580 // If there is a client, tell the client about installation. 580 // If there is a client, tell the client about installation.
581 if (client_) 581 if (client_)
582 client_->OnInstallSuccess(extension_.get(), install_icon_.get()); 582 client_->OnInstallSuccess(extension_.get(), install_icon_.get());
583 583
584 // We update the extension's granted permissions if the user already approved 584 // We update the extension's granted permissions if the user already approved
585 // the install (client_ is non NULL), or we are allowed to install this 585 // the install (client_ is non NULL), or we are allowed to install this
586 // silently. We only track granted permissions for INTERNAL extensions. 586 // silently.
587 if ((client_ || allow_silent_install_) && 587 if (client_ || allow_silent_install_) {
588 extension_->location() == Extension::INTERNAL) {
589 PermissionsUpdater perms_updater(profile()); 588 PermissionsUpdater perms_updater(profile());
590 perms_updater.GrantActivePermissions(extension_); 589 perms_updater.GrantActivePermissions(extension_);
591 } 590 }
592 591
593 // Tell the frontend about the installation and hand off ownership of 592 // Tell the frontend about the installation and hand off ownership of
594 // extension_ to it. 593 // extension_ to it.
595 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(), 594 frontend_weak_->OnExtensionInstalled(extension_, is_gallery_install(),
596 page_ordinal_); 595 page_ordinal_);
597 596
598 NotifyCrxInstallComplete(extension_.get()); 597 NotifyCrxInstallComplete(extension_.get());
599 598
600 extension_ = NULL; 599 extension_ = NULL;
601 600
602 // We're done. We don't post any more tasks to ourselves so we are deleted 601 // We're done. We don't post any more tasks to ourselves so we are deleted
603 // soon. 602 // soon.
604 } 603 }
605 604
606 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { 605 void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) {
607 // Some users (such as the download shelf) need to know when a 606 // Some users (such as the download shelf) need to know when a
608 // CRXInstaller is done. Listening for the EXTENSION_* events 607 // CRXInstaller is done. Listening for the EXTENSION_* events
609 // is problematic because they don't know anything about the 608 // is problematic because they don't know anything about the
610 // extension before it is unpacked, so they cannot filter based 609 // extension before it is unpacked, so they cannot filter based
611 // on the extension. 610 // on the extension.
612 content::NotificationService::current()->Notify( 611 content::NotificationService::current()->Notify(
613 chrome::NOTIFICATION_CRX_INSTALLER_DONE, 612 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
614 content::Source<CrxInstaller>(this), 613 content::Source<CrxInstaller>(this),
615 content::Details<const Extension>(extension)); 614 content::Details<const Extension>(extension));
616 } 615 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698