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

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

Issue 8662008: Implement chrome.systemPrivate.getIncognitoModeAvailability extension API function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged with ToT Created 9 years 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) 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"
(...skipping 11 matching lines...) Expand all
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/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
28 28
29 namespace { 29 namespace {
30 30
31 struct PrefMappingEntry { 31 struct PrefMappingEntry {
32 // Name of the preference referenced by extension_api.json.
32 const char* extension_pref; 33 const char* extension_pref;
34
35 // Name of the preference in the PrefStores.
33 const char* browser_pref; 36 const char* browser_pref;
37
38 // Permission required to access this preference.
39 // Use ExtensionAPIPermission::kInvalid for |permission| to express that no
40 // permission is necessary.
34 ExtensionAPIPermission::ID permission; 41 ExtensionAPIPermission::ID permission;
35 }; 42 };
36 43
37 const char kNotControllable[] = "not_controllable"; 44 const char kNotControllable[] = "not_controllable";
38 const char kControlledByOtherExtensions[] = "controlled_by_other_extensions"; 45 const char kControlledByOtherExtensions[] = "controlled_by_other_extensions";
39 const char kControllableByThisExtension[] = "controllable_by_this_extension"; 46 const char kControllableByThisExtension[] = "controllable_by_this_extension";
40 const char kControlledByThisExtension[] = "controlled_by_this_extension"; 47 const char kControlledByThisExtension[] = "controlled_by_this_extension";
41 48
42 const char kIncognitoSpecific[] = "incognitoSpecific"; 49 const char kIncognitoSpecific[] = "incognitoSpecific";
43 const char kLevelOfControl[] = "levelOfControl"; 50 const char kLevelOfControl[] = "levelOfControl";
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 pref_key, &browser_pref, &permission)); 511 pref_key, &browser_pref, &permission));
505 if (!GetExtension()->HasAPIPermission(permission)) { 512 if (!GetExtension()->HasAPIPermission(permission)) {
506 error_ = ExtensionErrorUtils::FormatErrorMessage( 513 error_ = ExtensionErrorUtils::FormatErrorMessage(
507 keys::kPermissionErrorMessage, pref_key); 514 keys::kPermissionErrorMessage, pref_key);
508 return false; 515 return false;
509 } 516 }
510 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); 517 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs();
511 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); 518 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
512 return true; 519 return true;
513 } 520 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_dispatcher.cc ('k') | chrome/browser/extensions/system/system_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698