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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_profile.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/prefs/public/pref_change_registrar.h" 16 #include "base/prefs/public/pref_change_registrar.h"
17 #include "base/prefs/public/pref_observer.h"
17 #include "chrome/browser/profiles/profile_keyed_service.h" 18 #include "chrome/browser/profiles/profile_keyed_service.h"
18 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" 19 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h"
19 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" 20 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h"
20 #include "chrome/common/spellcheck_common.h" 21 #include "chrome/common/spellcheck_common.h"
21 #include "content/public/browser/notification_observer.h"
22 22
23 class Profile; 23 class Profile;
24 class SpellCheckHost; 24 class SpellCheckHost;
25 class SpellCheckHostMetrics; 25 class SpellCheckHostMetrics;
26 26
27 namespace net { 27 namespace net {
28 class URLRequestContextGetter; 28 class URLRequestContextGetter;
29 } 29 }
30 30
31 // A facade of spell-check related objects in the browser process. 31 // A facade of spell-check related objects in the browser process.
32 // This class is responsible for managing a life-cycle of: 32 // This class is responsible for managing a life-cycle of:
33 // * SpellCheckHost object (instantiation, deletion, reset) 33 // * SpellCheckHost object (instantiation, deletion, reset)
34 // * SpellCheckHostMetrics object (only initiate when metrics is enabled) 34 // * SpellCheckHostMetrics object (only initiate when metrics is enabled)
35 // 35 //
36 // The class is intended to be owned and managed by SpellCheckFactory 36 // The class is intended to be owned and managed by SpellCheckFactory
37 // internally. Any usable APIs are provided by SpellCheckHost interface, which 37 // internally. Any usable APIs are provided by SpellCheckHost interface, which
38 // can be retrieved from SpellCheckFactory::GetHostForProfile(); 38 // can be retrieved from SpellCheckFactory::GetHostForProfile();
39 class SpellCheckProfile : public SpellCheckProfileProvider, 39 class SpellCheckProfile : public SpellCheckProfileProvider,
40 public ProfileKeyedService, 40 public ProfileKeyedService,
41 public content::NotificationObserver { 41 public PrefObserver {
42 public: 42 public:
43 explicit SpellCheckProfile(Profile* profile); 43 explicit SpellCheckProfile(Profile* profile);
44 virtual ~SpellCheckProfile(); 44 virtual ~SpellCheckProfile();
45 45
46 // Retrieves SpellCheckHost object. 46 // Retrieves SpellCheckHost object.
47 // This can return NULL when the spell-checking is disabled 47 // This can return NULL when the spell-checking is disabled
48 // or the host object is not ready yet. 48 // or the host object is not ready yet.
49 SpellCheckHost* GetHost(); 49 SpellCheckHost* GetHost();
50 50
51 // If |force| is false, and the spellchecker is already initialized (or is in 51 // If |force| is false, and the spellchecker is already initialized (or is in
(...skipping 12 matching lines...) Expand all
64 virtual const chrome::spellcheck_common::WordList& 64 virtual const chrome::spellcheck_common::WordList&
65 GetCustomWords() const OVERRIDE; 65 GetCustomWords() const OVERRIDE;
66 virtual void CustomWordAddedLocally(const std::string& word) OVERRIDE; 66 virtual void CustomWordAddedLocally(const std::string& word) OVERRIDE;
67 virtual void LoadCustomDictionary( 67 virtual void LoadCustomDictionary(
68 chrome::spellcheck_common::WordList* custom_words) OVERRIDE; 68 chrome::spellcheck_common::WordList* custom_words) OVERRIDE;
69 virtual void WriteWordToCustomDictionary(const std::string& word) OVERRIDE; 69 virtual void WriteWordToCustomDictionary(const std::string& word) OVERRIDE;
70 70
71 // ProfileKeyedService implementation. 71 // ProfileKeyedService implementation.
72 virtual void Shutdown() OVERRIDE; 72 virtual void Shutdown() OVERRIDE;
73 73
74 // content::NotificationObserver implementation. 74 // PrefObserver implementation.
75 virtual void Observe(int type, 75 virtual void OnPreferenceChanged(PrefServiceBase* service,
76 const content::NotificationSource& source, 76 const std::string& pref_name) OVERRIDE;
77 const content::NotificationDetails& details) OVERRIDE;
78 77
79 protected: 78 protected:
80 // Only tests should override this. 79 // Only tests should override this.
81 virtual SpellCheckHost* CreateHost( 80 virtual SpellCheckHost* CreateHost(
82 SpellCheckProfileProvider* provider, 81 SpellCheckProfileProvider* provider,
83 const std::string& language, 82 const std::string& language,
84 net::URLRequestContextGetter* request_context, 83 net::URLRequestContextGetter* request_context,
85 SpellCheckHostMetrics* metrics); 84 SpellCheckHostMetrics* metrics);
86 85
87 virtual bool IsTesting() const; 86 virtual bool IsTesting() const;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 136
138 // A directory path of profile. 137 // A directory path of profile.
139 FilePath profile_dir_; 138 FilePath profile_dir_;
140 139
141 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_; 140 scoped_ptr<SpellcheckCustomDictionary> custom_dictionary_;
142 141
143 DISALLOW_COPY_AND_ASSIGN(SpellCheckProfile); 142 DISALLOW_COPY_AND_ASSIGN(SpellCheckProfile);
144 }; 143 };
145 144
146 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_ 145 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/browser/speech/chrome_speech_recognition_preferences.cc ('k') | chrome/browser/spellchecker/spellcheck_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698