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

Side by Side Diff: chrome/browser/extensions/api/spellcheck/spellcheck_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/spellcheck/spellcheck_api.h" 5 #include "chrome/browser/extensions/api/spellcheck/spellcheck_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/spellchecker/spellcheck_factory.h" 10 #include "chrome/browser/spellchecker/spellcheck_factory.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 Profile* profile = Profile::FromBrowserContext(context); 44 Profile* profile = Profile::FromBrowserContext(context);
45 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 45 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
46 content::Source<Profile>(profile)); 46 content::Source<Profile>(profile));
47 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 47 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
48 content::Source<Profile>(profile)); 48 content::Source<Profile>(profile));
49 } 49 }
50 50
51 SpellcheckAPI::~SpellcheckAPI() { 51 SpellcheckAPI::~SpellcheckAPI() {
52 } 52 }
53 53
54 static base::LazyInstance<ProfileKeyedAPIFactory<SpellcheckAPI> > 54 static base::LazyInstance<BrowserContextKeyedAPIFactory<SpellcheckAPI> >
55 g_factory = LAZY_INSTANCE_INITIALIZER; 55 g_factory = LAZY_INSTANCE_INITIALIZER;
56 56
57 // static 57 // static
58 ProfileKeyedAPIFactory<SpellcheckAPI>* SpellcheckAPI::GetFactoryInstance() { 58 BrowserContextKeyedAPIFactory<SpellcheckAPI>*
59 SpellcheckAPI::GetFactoryInstance() {
59 return g_factory.Pointer(); 60 return g_factory.Pointer();
60 } 61 }
61 62
62 void SpellcheckAPI::Observe(int type, 63 void SpellcheckAPI::Observe(int type,
63 const content::NotificationSource& source, 64 const content::NotificationSource& source,
64 const content::NotificationDetails& details) { 65 const content::NotificationDetails& details) {
65 Profile* profile = content::Source<Profile>(source).ptr(); 66 Profile* profile = content::Source<Profile>(source).ptr();
66 SpellcheckService* spellcheck = NULL; 67 SpellcheckService* spellcheck = NULL;
67 switch (type) { 68 switch (type) {
68 case chrome::NOTIFICATION_EXTENSION_LOADED: { 69 case chrome::NOTIFICATION_EXTENSION_LOADED: {
(...skipping 22 matching lines...) Expand all
91 spellcheck->UnloadExternalDictionary(spellcheck_info->path); 92 spellcheck->UnloadExternalDictionary(spellcheck_info->path);
92 } 93 }
93 break; 94 break;
94 } 95 }
95 default: 96 default:
96 NOTREACHED(); 97 NOTREACHED();
97 } 98 }
98 } 99 }
99 100
100 template <> 101 template <>
101 void ProfileKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { 102 void
103 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() {
102 DependsOn(SpellcheckServiceFactory::GetInstance()); 104 DependsOn(SpellcheckServiceFactory::GetInstance());
103 } 105 }
104 106
105 } // namespace extensions 107 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/spellcheck/spellcheck_api.h ('k') | chrome/browser/extensions/api/storage/settings_frontend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698