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/api/preference/preference_helpers.h" | 5 #include "chrome/browser/extensions/api/preference/preference_helpers.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const char* GetLevelOfControl( | 55 const char* GetLevelOfControl( |
56 Profile* profile, | 56 Profile* profile, |
57 const std::string& extension_id, | 57 const std::string& extension_id, |
58 const std::string& browser_pref, | 58 const std::string& browser_pref, |
59 bool incognito) { | 59 bool incognito) { |
60 PrefService* prefs = incognito ? profile->GetOffTheRecordPrefs() | 60 PrefService* prefs = incognito ? profile->GetOffTheRecordPrefs() |
61 : profile->GetPrefs(); | 61 : profile->GetPrefs(); |
62 bool from_incognito = false; | 62 bool from_incognito = false; |
63 bool* from_incognito_ptr = incognito ? &from_incognito : NULL; | 63 bool* from_incognito_ptr = incognito ? &from_incognito : NULL; |
64 const PrefService::Preference* pref = | 64 const PrefService::Preference* pref = |
65 prefs->FindPreference(browser_pref.c_str()); | 65 prefs->FindPreference(browser_pref); |
66 CHECK(pref); | 66 CHECK(pref); |
67 | 67 |
68 if (!pref->IsExtensionModifiable()) | 68 if (!pref->IsExtensionModifiable()) |
69 return kNotControllable; | 69 return kNotControllable; |
70 | 70 |
71 if (PreferenceAPI::Get(profile)->DoesExtensionControlPref( | 71 if (PreferenceAPI::Get(profile)->DoesExtensionControlPref( |
72 extension_id, | 72 extension_id, |
73 browser_pref, | 73 browser_pref, |
74 from_incognito_ptr)) { | 74 from_incognito_ptr)) { |
75 return kControlledByThisExtension; | 75 return kControlledByThisExtension; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 std::unique_ptr<Event> event( | 131 std::unique_ptr<Event> event( |
132 new Event(histogram_value, event_name, std::move(args_copy))); | 132 new Event(histogram_value, event_name, std::move(args_copy))); |
133 event->restrict_to_browser_context = restrict_to_profile; | 133 event->restrict_to_browser_context = restrict_to_profile; |
134 router->DispatchEventToExtension(extension->id(), std::move(event)); | 134 router->DispatchEventToExtension(extension->id(), std::move(event)); |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 } // namespace preference_helpers | 139 } // namespace preference_helpers |
140 } // namespace extensions | 140 } // namespace extensions |
OLD | NEW |