| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_preference_api.h" | 5 #include "chrome/browser/extensions/extension_preference_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/extensions/extension_event_router.h" | 14 #include "chrome/browser/extensions/extension_event_router.h" |
| 15 #include "chrome/browser/extensions/extension_preference_api_constants.h" | 15 #include "chrome/browser/extensions/extension_preference_api_constants.h" |
| 16 #include "chrome/browser/extensions/extension_preference_helpers.h" | 16 #include "chrome/browser/extensions/extension_preference_helpers.h" |
| 17 #include "chrome/browser/extensions/extension_prefs.h" | 17 #include "chrome/browser/extensions/extension_prefs.h" |
| 18 #include "chrome/browser/extensions/extension_prefs_scope.h" | 18 #include "chrome/browser/extensions/extension_prefs_scope.h" |
| 19 #include "chrome/browser/extensions/extension_proxy_api.h" | 19 #include "chrome/browser/extensions/extension_proxy_api.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/extensions/extension_error_utils.h" | 23 #include "chrome/common/extensions/extension_error_utils.h" |
| 24 #include "chrome/common/extensions/extension_permission_set.h" | 24 #include "chrome/common/extensions/extension_permission_set.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "content/common/notification_service.h" | 26 #include "content/public/browser/notification_details.h" |
| 27 #include "content/public/browser/notification_source.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 struct PrefMappingEntry { | 31 struct PrefMappingEntry { |
| 31 const char* extension_pref; | 32 const char* extension_pref; |
| 32 const char* browser_pref; | 33 const char* browser_pref; |
| 33 ExtensionAPIPermission::ID permission; | 34 ExtensionAPIPermission::ID permission; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 const char kNotControllable[] = "not_controllable"; | 37 const char kNotControllable[] = "not_controllable"; |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 pref_key, &browser_pref, &permission)); | 504 pref_key, &browser_pref, &permission)); |
| 504 if (!GetExtension()->HasAPIPermission(permission)) { | 505 if (!GetExtension()->HasAPIPermission(permission)) { |
| 505 error_ = ExtensionErrorUtils::FormatErrorMessage( | 506 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 506 keys::kPermissionErrorMessage, pref_key); | 507 keys::kPermissionErrorMessage, pref_key); |
| 507 return false; | 508 return false; |
| 508 } | 509 } |
| 509 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); | 510 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); |
| 510 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); | 511 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); |
| 511 return true; | 512 return true; |
| 512 } | 513 } |
| OLD | NEW |