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

Side by Side Diff: chrome/browser/extensions/api/settings_overrides/settings_overrides_api.cc

Issue 219593002: Add unit test for the Settings API Bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 6 years, 8 months 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_message_bubble_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/settings_overrides/settings_overrides_ap i.h" 5 #include "chrome/browser/extensions/api/settings_overrides/settings_overrides_ap i.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/api/preference/preference_api.h" 10 #include "chrome/browser/extensions/api/preference/preference_api.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 BrowserContextKeyedAPIFactory<SettingsOverridesAPI>* 106 BrowserContextKeyedAPIFactory<SettingsOverridesAPI>*
107 SettingsOverridesAPI::GetFactoryInstance() { 107 SettingsOverridesAPI::GetFactoryInstance() {
108 return g_factory.Pointer(); 108 return g_factory.Pointer();
109 } 109 }
110 110
111 void SettingsOverridesAPI::SetPref(const std::string& extension_id, 111 void SettingsOverridesAPI::SetPref(const std::string& extension_id,
112 const std::string& pref_key, 112 const std::string& pref_key,
113 base::Value* value) { 113 base::Value* value) {
114 PreferenceAPI::Get(profile_)->SetExtensionControlledPref( 114 PreferenceAPI* prefs = PreferenceAPI::Get(profile_);
115 extension_id, 115 if (!prefs)
116 pref_key, 116 return; // Expected in unit tests.
117 kExtensionPrefsScopeRegular, 117 prefs->SetExtensionControlledPref(extension_id,
118 value); 118 pref_key,
119 kExtensionPrefsScopeRegular,
120 value);
119 } 121 }
120 122
121 void SettingsOverridesAPI::UnsetPref(const std::string& extension_id, 123 void SettingsOverridesAPI::UnsetPref(const std::string& extension_id,
122 const std::string& pref_key) { 124 const std::string& pref_key) {
123 PreferenceAPI::Get(profile_)->RemoveExtensionControlledPref( 125 PreferenceAPI* prefs = PreferenceAPI::Get(profile_);
126 if (!prefs)
127 return; // Expected in unit tests.
128 prefs->RemoveExtensionControlledPref(
124 extension_id, 129 extension_id,
125 pref_key, 130 pref_key,
126 kExtensionPrefsScopeRegular); 131 kExtensionPrefsScopeRegular);
127 } 132 }
128 133
129 void SettingsOverridesAPI::Observe( 134 void SettingsOverridesAPI::Observe(
130 int type, 135 int type,
131 const content::NotificationSource& source, 136 const content::NotificationSource& source,
132 const content::NotificationDetails& details) { 137 const content::NotificationDetails& details) {
133 switch (type) { 138 switch (type) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 251
247 template <> 252 template <>
248 void BrowserContextKeyedAPIFactory< 253 void BrowserContextKeyedAPIFactory<
249 SettingsOverridesAPI>::DeclareFactoryDependencies() { 254 SettingsOverridesAPI>::DeclareFactoryDependencies() {
250 DependsOn(ExtensionPrefsFactory::GetInstance()); 255 DependsOn(ExtensionPrefsFactory::GetInstance());
251 DependsOn(PreferenceAPI::GetFactoryInstance()); 256 DependsOn(PreferenceAPI::GetFactoryInstance());
252 DependsOn(TemplateURLServiceFactory::GetInstance()); 257 DependsOn(TemplateURLServiceFactory::GetInstance());
253 } 258 }
254 259
255 } // namespace extensions 260 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_message_bubble_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698