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

Side by Side Diff: chrome/browser/extensions/api/spellcheck/spellcheck_api.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time 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 26 matching lines...) Expand all
37 return SpellcheckService::DICT_UNKNOWN; 37 return SpellcheckService::DICT_UNKNOWN;
38 } 38 }
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context) { 43 SpellcheckAPI::SpellcheckAPI(content::BrowserContext* context) {
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_DEPRECATED,
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<BrowserContextKeyedAPIFactory<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
(...skipping 16 matching lines...) Expand all
74 // TODO(rlp): Handle load failure. = 74 // TODO(rlp): Handle load failure. =
75 spellcheck = SpellcheckServiceFactory::GetForContext(profile); 75 spellcheck = SpellcheckServiceFactory::GetForContext(profile);
76 spellcheck->LoadExternalDictionary( 76 spellcheck->LoadExternalDictionary(
77 spellcheck_info->language, 77 spellcheck_info->language,
78 spellcheck_info->locale, 78 spellcheck_info->locale,
79 spellcheck_info->path, 79 spellcheck_info->path,
80 GetDictionaryFormat(spellcheck_info->format)); 80 GetDictionaryFormat(spellcheck_info->format));
81 } 81 }
82 break; 82 break;
83 } 83 }
84 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 84 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
85 const Extension* extension = 85 const Extension* extension =
86 content::Details<UnloadedExtensionInfo>(details)->extension; 86 content::Details<UnloadedExtensionInfo>(details)->extension;
87 SpellcheckDictionaryInfo* spellcheck_info = 87 SpellcheckDictionaryInfo* spellcheck_info =
88 GetSpellcheckDictionaryInfo(extension); 88 GetSpellcheckDictionaryInfo(extension);
89 if (spellcheck_info) { 89 if (spellcheck_info) {
90 // TODO(rlp): Handle unload failure. 90 // TODO(rlp): Handle unload failure.
91 spellcheck = SpellcheckServiceFactory::GetForContext(profile); 91 spellcheck = SpellcheckServiceFactory::GetForContext(profile);
92 spellcheck->UnloadExternalDictionary(spellcheck_info->path); 92 spellcheck->UnloadExternalDictionary(spellcheck_info->path);
93 } 93 }
94 break; 94 break;
95 } 95 }
96 default: 96 default:
97 NOTREACHED(); 97 NOTREACHED();
98 } 98 }
99 } 99 }
100 100
101 template <> 101 template <>
102 void 102 void
103 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() { 103 BrowserContextKeyedAPIFactory<SpellcheckAPI>::DeclareFactoryDependencies() {
104 DependsOn(SpellcheckServiceFactory::GetInstance()); 104 DependsOn(SpellcheckServiceFactory::GetInstance());
105 } 105 }
106 106
107 } // namespace extensions 107 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698