| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 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 = prefs->FindPreference(browser_pref); |
| 65 prefs->FindPreference(browser_pref.c_str()); | |
| 66 CHECK(pref); | 65 CHECK(pref); |
| 67 | 66 |
| 68 if (!pref->IsExtensionModifiable()) | 67 if (!pref->IsExtensionModifiable()) |
| 69 return kNotControllable; | 68 return kNotControllable; |
| 70 | 69 |
| 71 if (PreferenceAPI::Get(profile)->DoesExtensionControlPref( | 70 if (PreferenceAPI::Get(profile)->DoesExtensionControlPref( |
| 72 extension_id, | 71 extension_id, |
| 73 browser_pref, | 72 browser_pref, |
| 74 from_incognito_ptr)) { | 73 from_incognito_ptr)) { |
| 75 return kControlledByThisExtension; | 74 return kControlledByThisExtension; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 std::unique_ptr<Event> event( | 130 std::unique_ptr<Event> event( |
| 132 new Event(histogram_value, event_name, std::move(args_copy))); | 131 new Event(histogram_value, event_name, std::move(args_copy))); |
| 133 event->restrict_to_browser_context = restrict_to_profile; | 132 event->restrict_to_browser_context = restrict_to_profile; |
| 134 router->DispatchEventToExtension(extension->id(), std::move(event)); | 133 router->DispatchEventToExtension(extension->id(), std::move(event)); |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace preference_helpers | 138 } // namespace preference_helpers |
| 140 } // namespace extensions | 139 } // namespace extensions |
| OLD | NEW |