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

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

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) { 76 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) {
77 CHECK(extension); 77 CHECK(extension);
78 78
79 // We only maintain the granted permissions prefs for INTERNAL and LOAD 79 // We only maintain the granted permissions prefs for INTERNAL and LOAD
80 // extensions. 80 // extensions.
81 if (!Manifest::IsUnpackedLocation(extension->location()) && 81 if (!Manifest::IsUnpackedLocation(extension->location()) &&
82 extension->location() != Manifest::INTERNAL) 82 extension->location() != Manifest::INTERNAL)
83 return; 83 return;
84 84
85 ExtensionPrefs::Get(profile_)->AddGrantedPermissions( 85 ExtensionPrefs::Get(profile_)->AddGrantedPermissions(
86 extension->id(), extension->GetActivePermissions()); 86 extension->id(), extension->GetActivePermissions().get());
87 } 87 }
88 88
89 void PermissionsUpdater::UpdateActivePermissions( 89 void PermissionsUpdater::UpdateActivePermissions(
90 const Extension* extension, const PermissionSet* permissions) { 90 const Extension* extension, const PermissionSet* permissions) {
91 ExtensionPrefs::Get(profile_)->SetActivePermissions( 91 ExtensionPrefs::Get(profile_)->SetActivePermissions(
92 extension->id(), permissions); 92 extension->id(), permissions);
93 PermissionsData::SetActivePermissions(extension, permissions); 93 PermissionsData::SetActivePermissions(extension, permissions);
94 } 94 }
95 95
96 void PermissionsUpdater::DispatchEvent( 96 void PermissionsUpdater::DispatchEvent(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 changed->apis(), 150 changed->apis(),
151 changed->explicit_hosts(), 151 changed->explicit_hosts(),
152 changed->scriptable_hosts())); 152 changed->scriptable_hosts()));
153 } 153 }
154 154
155 // Trigger the onAdded and onRemoved events in the extension. 155 // Trigger the onAdded and onRemoved events in the extension.
156 DispatchEvent(extension->id(), event_name, changed); 156 DispatchEvent(extension->id(), event_name, changed);
157 } 157 }
158 158
159 } // namespace extensions 159 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/page_action_controller.cc ('k') | chrome/browser/extensions/permissions_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698