| OLD | NEW |
| 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/extension_preference_helpers.h" | 5 #include "chrome/browser/extensions/api/preference/preference_helpers.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/event_router.h" | 9 #include "chrome/browser/extensions/event_router.h" |
| 10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 | 14 |
| 15 namespace extensions { |
| 16 namespace preference_helpers { |
| 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 const char kIncognitoPersistent[] = "incognito_persistent"; | 20 const char kIncognitoPersistent[] = "incognito_persistent"; |
| 18 const char kIncognitoSessionOnly[] = "incognito_session_only"; | 21 const char kIncognitoSessionOnly[] = "incognito_session_only"; |
| 19 const char kRegular[] = "regular"; | 22 const char kRegular[] = "regular"; |
| 20 const char kRegularOnly[] = "regular_only"; | 23 const char kRegularOnly[] = "regular_only"; |
| 21 | 24 |
| 22 const char kLevelOfControlKey[] = "levelOfControl"; | 25 const char kLevelOfControlKey[] = "levelOfControl"; |
| 23 | 26 |
| 24 const char kNotControllable[] = "not_controllable"; | 27 const char kNotControllable[] = "not_controllable"; |
| 25 const char kControlledByOtherExtensions[] = "controlled_by_other_extensions"; | 28 const char kControlledByOtherExtensions[] = "controlled_by_other_extensions"; |
| 26 const char kControllableByThisExtension[] = "controllable_by_this_extension"; | 29 const char kControllableByThisExtension[] = "controllable_by_this_extension"; |
| 27 const char kControlledByThisExtension[] = "controlled_by_this_extension"; | 30 const char kControlledByThisExtension[] = "controlled_by_this_extension"; |
| 28 | 31 |
| 29 } // namespace | 32 } // namespace |
| 30 | 33 |
| 31 namespace extension_preference_helpers { | |
| 32 | |
| 33 bool StringToScope(const std::string& s, | 34 bool StringToScope(const std::string& s, |
| 34 extensions::ExtensionPrefsScope* scope) { | 35 extensions::ExtensionPrefsScope* scope) { |
| 35 if (s == kRegular) | 36 if (s == kRegular) |
| 36 *scope = extensions::kExtensionPrefsScopeRegular; | 37 *scope = extensions::kExtensionPrefsScopeRegular; |
| 37 else if (s == kRegularOnly) | 38 else if (s == kRegularOnly) |
| 38 *scope = extensions::kExtensionPrefsScopeRegularOnly; | 39 *scope = extensions::kExtensionPrefsScopeRegularOnly; |
| 39 else if (s == kIncognitoPersistent) | 40 else if (s == kIncognitoPersistent) |
| 40 *scope = extensions::kExtensionPrefsScopeIncognitoPersistent; | 41 *scope = extensions::kExtensionPrefsScopeIncognitoPersistent; |
| 41 else if (s == kIncognitoSessionOnly) | 42 else if (s == kIncognitoSessionOnly) |
| 42 *scope = extensions::kExtensionPrefsScopeIncognitoSessionOnly; | 43 *scope = extensions::kExtensionPrefsScopeIncognitoSessionOnly; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 126 } |
| 126 | 127 |
| 127 scoped_ptr<ListValue> args_copy(args->DeepCopy()); | 128 scoped_ptr<ListValue> args_copy(args->DeepCopy()); |
| 128 router->DispatchEventToExtension( | 129 router->DispatchEventToExtension( |
| 129 extension_id, event_name, args_copy.Pass(), restrict_to_profile, | 130 extension_id, event_name, args_copy.Pass(), restrict_to_profile, |
| 130 GURL()); | 131 GURL()); |
| 131 } | 132 } |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace extension_preference_helpers | 136 } // namespace preference_helpers |
| 137 } // namespace extensions |
| OLD | NEW |