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

Side by Side Diff: chrome/browser/extensions/extension_service.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: . 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 // still remember that "omnibox" had been granted, so that if the 2109 // still remember that "omnibox" had been granted, so that if the
2110 // extension once again includes "omnibox" in an upgrade, the extension 2110 // extension once again includes "omnibox" in an upgrade, the extension
2111 // can upgrade without requiring this user's approval. 2111 // can upgrade without requiring this user's approval.
2112 const Extension* old = GetExtensionByIdInternal(extension->id(), 2112 const Extension* old = GetExtensionByIdInternal(extension->id(),
2113 true, true, false); 2113 true, true, false);
2114 bool is_extension_upgrade = old != NULL; 2114 bool is_extension_upgrade = old != NULL;
2115 bool is_privilege_increase = false; 2115 bool is_privilege_increase = false;
2116 2116
2117 // We only need to compare the granted permissions to the current permissions 2117 // We only need to compare the granted permissions to the current permissions
2118 // if the extension is not allowed to silently increase its permissions. 2118 // if the extension is not allowed to silently increase its permissions.
2119 if (!extension->CanSilentlyIncreasePermissions()) { 2119 if (!extension->CanSilentlyIncreasePermissionsDuringInstall()) {
2120 // Add all the recognized permissions if the granted permissions list 2120 // Add all the recognized permissions if the granted permissions list
2121 // hasn't been initialized yet. 2121 // hasn't been initialized yet.
2122 scoped_refptr<ExtensionPermissionSet> granted_permissions = 2122 scoped_refptr<ExtensionPermissionSet> granted_permissions =
2123 extension_prefs_->GetGrantedPermissions(extension->id()); 2123 extension_prefs_->GetGrantedPermissions(extension->id());
2124 CHECK(granted_permissions.get()); 2124 CHECK(granted_permissions.get());
2125 2125
2126 // Here, we check if an extension's privileges have increased in a manner 2126 // Here, we check if an extension's privileges have increased in a manner
2127 // that requires the user's approval. This could occur because the browser 2127 // that requires the user's approval. This could occur because the browser
2128 // upgraded and recognized additional privileges, or an extension upgrades 2128 // upgraded and recognized additional privileges, or an extension upgrades
2129 // to a version that requires additional privileges. 2129 // to a version that requires additional privileges.
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2695 // 2695 //
2696 // To coexist with certain unit tests that don't have an IO thread message 2696 // To coexist with certain unit tests that don't have an IO thread message
2697 // loop available at ExtensionService shutdown, we lazy-initialize this 2697 // loop available at ExtensionService shutdown, we lazy-initialize this
2698 // object so that those cases neither create nor destroy a SocketController. 2698 // object so that those cases neither create nor destroy a SocketController.
2699 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2699 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2700 if (!socket_controller_) { 2700 if (!socket_controller_) {
2701 socket_controller_ = new extensions::SocketController(); 2701 socket_controller_ = new extensions::SocketController();
2702 } 2702 }
2703 return socket_controller_; 2703 return socket_controller_;
2704 } 2704 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698