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

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

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/permissions_updater.h" 5 #include "chrome/browser/extensions/permissions_updater.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" 10 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 NotifyPermissionsUpdated(REMOVED, extension, removed.get()); 129 NotifyPermissionsUpdated(REMOVED, extension, removed.get());
130 } 130 }
131 131
132 void PermissionsUpdater::GrantActivePermissions(const Extension* extension, 132 void PermissionsUpdater::GrantActivePermissions(const Extension* extension,
133 bool record_oauth2_grant) { 133 bool record_oauth2_grant) {
134 CHECK(extension); 134 CHECK(extension);
135 135
136 // We only maintain the granted permissions prefs for INTERNAL and LOAD 136 // We only maintain the granted permissions prefs for INTERNAL and LOAD
137 // extensions. 137 // extensions.
138 if (extension->location() != Extension::LOAD && 138 if (extension->location() != Manifest::LOAD &&
139 extension->location() != Extension::INTERNAL) 139 extension->location() != Manifest::INTERNAL)
140 return; 140 return;
141 141
142 if (record_oauth2_grant) { 142 if (record_oauth2_grant) {
143 // Only record OAuth grant if: 143 // Only record OAuth grant if:
144 // 1. The extension has client id and scopes. 144 // 1. The extension has client id and scopes.
145 // 2. The user is signed in to Chrome. 145 // 2. The user is signed in to Chrome.
146 const Extension::OAuth2Info& oauth2_info = extension->oauth2_info(); 146 const Extension::OAuth2Info& oauth2_info = extension->oauth2_info();
147 if (!oauth2_info.client_id.empty() && !oauth2_info.scopes.empty()) { 147 if (!oauth2_info.client_id.empty() && !oauth2_info.scopes.empty()) {
148 TokenService* token_service = TokenServiceFactory::GetForProfile( 148 TokenService* token_service = TokenServiceFactory::GetForProfile(
149 profile_); 149 profile_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // Trigger the onAdded and onRemoved events in the extension. 225 // Trigger the onAdded and onRemoved events in the extension.
226 DispatchEvent(extension->id(), event_name, changed); 226 DispatchEvent(extension->id(), event_name, changed);
227 } 227 }
228 228
229 ExtensionPrefs* PermissionsUpdater::GetExtensionPrefs() { 229 ExtensionPrefs* PermissionsUpdater::GetExtensionPrefs() {
230 return extensions::ExtensionSystem::Get(profile_)->extension_service()-> 230 return extensions::ExtensionSystem::Get(profile_)->extension_service()->
231 extension_prefs(); 231 extension_prefs();
232 } 232 }
233 233
234 } // namespace extensions 234 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/pending_extension_manager.cc ('k') | chrome/browser/extensions/permissions_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698