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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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
OLDNEW
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/extension_action/extension_action_api.h" 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 return dict.Pass(); 210 return dict.Pass();
211 } 211 }
212 212
213 } // namespace 213 } // namespace
214 214
215 // 215 //
216 // ExtensionActionAPI 216 // ExtensionActionAPI
217 // 217 //
218 218
219 static base::LazyInstance<ProfileKeyedAPIFactory<ExtensionActionAPI> > 219 static base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionActionAPI> >
220 g_factory = LAZY_INSTANCE_INITIALIZER; 220 g_factory = LAZY_INSTANCE_INITIALIZER;
221 221
222 ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext* context) { 222 ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext* context) {
223 ExtensionFunctionRegistry* registry = 223 ExtensionFunctionRegistry* registry =
224 ExtensionFunctionRegistry::GetInstance(); 224 ExtensionFunctionRegistry::GetInstance();
225 225
226 // Browser Actions 226 // Browser Actions
227 registry->RegisterFunction<BrowserActionSetIconFunction>(); 227 registry->RegisterFunction<BrowserActionSetIconFunction>();
228 registry->RegisterFunction<BrowserActionSetTitleFunction>(); 228 registry->RegisterFunction<BrowserActionSetTitleFunction>();
229 registry->RegisterFunction<BrowserActionSetBadgeTextFunction>(); 229 registry->RegisterFunction<BrowserActionSetBadgeTextFunction>();
(...skipping 16 matching lines...) Expand all
246 registry->RegisterFunction<PageActionSetTitleFunction>(); 246 registry->RegisterFunction<PageActionSetTitleFunction>();
247 registry->RegisterFunction<PageActionSetPopupFunction>(); 247 registry->RegisterFunction<PageActionSetPopupFunction>();
248 registry->RegisterFunction<PageActionGetTitleFunction>(); 248 registry->RegisterFunction<PageActionGetTitleFunction>();
249 registry->RegisterFunction<PageActionGetPopupFunction>(); 249 registry->RegisterFunction<PageActionGetPopupFunction>();
250 } 250 }
251 251
252 ExtensionActionAPI::~ExtensionActionAPI() { 252 ExtensionActionAPI::~ExtensionActionAPI() {
253 } 253 }
254 254
255 // static 255 // static
256 ProfileKeyedAPIFactory<ExtensionActionAPI>* 256 BrowserContextKeyedAPIFactory<ExtensionActionAPI>*
257 ExtensionActionAPI::GetFactoryInstance() { 257 ExtensionActionAPI::GetFactoryInstance() {
258 return g_factory.Pointer(); 258 return g_factory.Pointer();
259 } 259 }
260 260
261 // static 261 // static
262 ExtensionActionAPI* ExtensionActionAPI::Get(content::BrowserContext* context) { 262 ExtensionActionAPI* ExtensionActionAPI::Get(content::BrowserContext* context) {
263 return ProfileKeyedAPIFactory<ExtensionActionAPI>::GetForProfile(context); 263 return BrowserContextKeyedAPIFactory<ExtensionActionAPI>::Get(context);
264 } 264 }
265 265
266 // static 266 // static
267 bool ExtensionActionAPI::GetBrowserActionVisibility( 267 bool ExtensionActionAPI::GetBrowserActionVisibility(
268 const ExtensionPrefs* prefs, 268 const ExtensionPrefs* prefs,
269 const std::string& extension_id) { 269 const std::string& extension_id) {
270 bool visible = false; 270 bool visible = false;
271 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id, 271 if (!prefs || !prefs->ReadPrefAsBoolean(extension_id,
272 kBrowserActionVisible, 272 kBrowserActionVisible,
273 &visible)) { 273 &visible)) {
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 return true; 938 return true;
939 } 939 }
940 940
941 bool EnablePageActionsFunction::RunImpl() { 941 bool EnablePageActionsFunction::RunImpl() {
942 return SetPageActionEnabled(true); 942 return SetPageActionEnabled(true);
943 } 943 }
944 944
945 bool DisablePageActionsFunction::RunImpl() { 945 bool DisablePageActionsFunction::RunImpl() {
946 return SetPageActionEnabled(false); 946 return SetPageActionEnabled(false);
947 } 947 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698