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

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

Issue 8233040: SpellCheck refactoring: Moved user custom dictionary for spell check to SpellCheckProfile. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Mentioned lifecycle of word_list Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_HOST_IMPL_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // alternate directory for download is chrome::DIR_USER_DATA. 73 // alternate directory for download is chrome::DIR_USER_DATA.
74 void InitializeDictionaryLocation(); 74 void InitializeDictionaryLocation();
75 75
76 // Load and parse the custom words dictionary and open the bdic file. 76 // Load and parse the custom words dictionary and open the bdic file.
77 // Executed on the file thread. 77 // Executed on the file thread.
78 void InitializeInternal(); 78 void InitializeInternal();
79 79
80 void InitializeOnFileThread(); 80 void InitializeOnFileThread();
81 81
82 // Inform |profile_| that initialization has finished. 82 // Inform |profile_| that initialization has finished.
83 // |custom_words| holds the custom word list which was
84 // loaded at the file thread.
85 void InformProfileOfInitializationWithCustomWords(
86 CustomWordList* custom_words);
87
88 // An alternative version of InformProfileOfInitializationWithCustomWords()
89 // which implies empty |custom_words|.
90 void InformProfileOfInitialization(); 83 void InformProfileOfInitialization();
91 84
92 // If |dictionary_file_| is missing, we attempt to download it. 85 // If |dictionary_file_| is missing, we attempt to download it.
93 void DownloadDictionary(); 86 void DownloadDictionary();
94 87
95 // Write a custom dictionary addition to disk.
96 void WriteWordToCustomDictionary(const std::string& word);
97
98 // Returns a metrics counter associated with this object, 88 // Returns a metrics counter associated with this object,
99 // or null when metrics recording is disabled. 89 // or null when metrics recording is disabled.
100 virtual SpellCheckHostMetrics* GetMetrics() const; 90 virtual SpellCheckHostMetrics* GetMetrics() const;
101 91
102 // Returns true if the dictionary is ready to use. 92 // Returns true if the dictionary is ready to use.
103 virtual bool IsReady() const; 93 virtual bool IsReady() const;
104 94
105 // URLFetcher::Delegate implementation. Called when we finish downloading the 95 // URLFetcher::Delegate implementation. Called when we finish downloading the
106 // spellcheck dictionary; saves the dictionary to |data_|. 96 // spellcheck dictionary; saves the dictionary to |data_|.
107 virtual void OnURLFetchComplete(const URLFetcher* source, 97 virtual void OnURLFetchComplete(const URLFetcher* source,
(...skipping 15 matching lines...) Expand all
123 // should be called before opening the file so we can delete it and download a 113 // should be called before opening the file so we can delete it and download a
124 // new dictionary if it is corrupted. 114 // new dictionary if it is corrupted.
125 bool VerifyBDict(const FilePath& path) const; 115 bool VerifyBDict(const FilePath& path) const;
126 116
127 // May be NULL. 117 // May be NULL.
128 SpellCheckProfileProvider* profile_; 118 SpellCheckProfileProvider* profile_;
129 119
130 // The desired location of the dictionary file (whether or not t exists yet). 120 // The desired location of the dictionary file (whether or not t exists yet).
131 FilePath bdict_file_path_; 121 FilePath bdict_file_path_;
132 122
133 // The location of the custom words file.
134 FilePath custom_dictionary_file_;
135
136 // The language of the dictionary file. 123 // The language of the dictionary file.
137 std::string language_; 124 std::string language_;
138 125
139 // The file descriptor/handle for the dictionary file. 126 // The file descriptor/handle for the dictionary file.
140 base::PlatformFile file_; 127 base::PlatformFile file_;
141 128
142 // We don't want to attempt to download a missing dictionary file more than 129 // We don't want to attempt to download a missing dictionary file more than
143 // once. 130 // once.
144 bool tried_to_download_; 131 bool tried_to_download_;
145 132
(...skipping 12 matching lines...) Expand all
158 145
159 NotificationRegistrar registrar_; 146 NotificationRegistrar registrar_;
160 147
161 // An optional metrics counter given by the constructor. 148 // An optional metrics counter given by the constructor.
162 SpellCheckHostMetrics* metrics_; 149 SpellCheckHostMetrics* metrics_;
163 150
164 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); 151 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl);
165 }; 152 };
166 153
167 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ 154 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698