| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/device_permissions_manager.h" | 5 #include "extensions/browser/api/device_permissions_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 for (size_t i = 0; i < devices->GetSize(); ++i) { | 146 for (size_t i = 0; i < devices->GetSize(); ++i) { |
| 147 base::DictionaryValue* dict_value; | 147 base::DictionaryValue* dict_value; |
| 148 if (!devices->GetDictionary(i, &dict_value)) { | 148 if (!devices->GetDictionary(i, &dict_value)) { |
| 149 continue; | 149 continue; |
| 150 } | 150 } |
| 151 if (!MatchesDevicePermissionEntry(dict_value, entry)) { | 151 if (!MatchesDevicePermissionEntry(dict_value, entry)) { |
| 152 continue; | 152 continue; |
| 153 } | 153 } |
| 154 devices->Set(i, entry->ToValue().release()); | 154 devices->Set(i, entry->ToValue()); |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Removes the given DevicePermissionEntry from ExtensionPrefs. | 159 // Removes the given DevicePermissionEntry from ExtensionPrefs. |
| 160 void RemoveDevicePermissionEntry(BrowserContext* context, | 160 void RemoveDevicePermissionEntry(BrowserContext* context, |
| 161 const std::string& extension_id, | 161 const std::string& extension_id, |
| 162 scoped_refptr<DevicePermissionEntry> entry) { | 162 scoped_refptr<DevicePermissionEntry> entry) { |
| 163 ExtensionPrefs* prefs = ExtensionPrefs::Get(context); | 163 ExtensionPrefs* prefs = ExtensionPrefs::Get(context); |
| 164 ExtensionPrefs::ScopedListUpdate update(prefs, extension_id, kDevices); | 164 ExtensionPrefs::ScopedListUpdate update(prefs, extension_id, kDevices); |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 724 |
| 725 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse( | 725 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse( |
| 726 BrowserContext* context) const { | 726 BrowserContext* context) const { |
| 727 // Return the original (possibly off-the-record) browser context so that a | 727 // Return the original (possibly off-the-record) browser context so that a |
| 728 // separate instance of the DevicePermissionsManager is used in incognito | 728 // separate instance of the DevicePermissionsManager is used in incognito |
| 729 // mode. The parent class's implemenation returns NULL. | 729 // mode. The parent class's implemenation returns NULL. |
| 730 return context; | 730 return context; |
| 731 } | 731 } |
| 732 | 732 |
| 733 } // namespace extensions | 733 } // namespace extensions |
| OLD | NEW |