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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc

Issue 1263423006: Rename spellchecker preprocessor flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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/spellchecker/spellcheck_hunspell_dictionary.h" 5 #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 file = other.object->file.Pass(); 90 file = other.object->file.Pass();
91 } 91 }
92 return *this; 92 return *this;
93 } 93 }
94 94
95 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( 95 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary(
96 const std::string& language, 96 const std::string& language,
97 net::URLRequestContextGetter* request_context_getter, 97 net::URLRequestContextGetter* request_context_getter,
98 SpellcheckService* spellcheck_service) 98 SpellcheckService* spellcheck_service)
99 : language_(language), 99 : language_(language),
100 use_platform_spellchecker_(false), 100 use_browser_spellchecker_(false),
101 request_context_getter_(request_context_getter), 101 request_context_getter_(request_context_getter),
102 spellcheck_service_(spellcheck_service), 102 spellcheck_service_(spellcheck_service),
103 download_status_(DOWNLOAD_NONE), 103 download_status_(DOWNLOAD_NONE),
104 weak_ptr_factory_(this) { 104 weak_ptr_factory_(this) {
105 } 105 }
106 106
107 SpellcheckHunspellDictionary::~SpellcheckHunspellDictionary() { 107 SpellcheckHunspellDictionary::~SpellcheckHunspellDictionary() {
108 } 108 }
109 109
110 void SpellcheckHunspellDictionary::Load() { 110 void SpellcheckHunspellDictionary::Load() {
111 DCHECK_CURRENTLY_ON(BrowserThread::UI); 111 DCHECK_CURRENTLY_ON(BrowserThread::UI);
112 112
113 #if defined(USE_PLATFORM_SPELLCHECKER) 113 #if defined(USE_BROWSER_SPELLCHECKER)
114 if (spellcheck_platform::SpellCheckerAvailable() && 114 if (spellcheck_platform::SpellCheckerAvailable() &&
115 spellcheck_platform::PlatformSupportsLanguage(language_)) { 115 spellcheck_platform::PlatformSupportsLanguage(language_)) {
116 use_platform_spellchecker_ = true; 116 use_browser_spellchecker_ = true;
117 spellcheck_platform::SetLanguage(language_); 117 spellcheck_platform::SetLanguage(language_);
118 base::MessageLoop::current()->PostTask(FROM_HERE, 118 base::MessageLoop::current()->PostTask(FROM_HERE,
119 base::Bind( 119 base::Bind(
120 &SpellcheckHunspellDictionary::InformListenersOfInitialization, 120 &SpellcheckHunspellDictionary::InformListenersOfInitialization,
121 weak_ptr_factory_.GetWeakPtr())); 121 weak_ptr_factory_.GetWeakPtr()));
122 return; 122 return;
123 } 123 }
124 #endif // USE_PLATFORM_SPELLCHECKER 124 #endif // USE_BROWSER_SPELLCHECKER
125 125
126 // Mac falls back on hunspell if its platform spellchecker isn't available. 126 // Mac falls back on hunspell if its platform spellchecker isn't available.
127 // However, Android does not support hunspell. 127 // However, Android does not support hunspell.
128 #if !defined(OS_ANDROID) 128 #if !defined(OS_ANDROID)
129 BrowserThread::PostTaskAndReplyWithResult( 129 BrowserThread::PostTaskAndReplyWithResult(
130 BrowserThread::FILE, 130 BrowserThread::FILE,
131 FROM_HERE, 131 FROM_HERE,
132 base::Bind(&InitializeDictionaryLocation, language_), 132 base::Bind(&InitializeDictionaryLocation, language_),
133 base::Bind( 133 base::Bind(
134 &SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete, 134 &SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete,
(...skipping 14 matching lines...) Expand all
149 149
150 const base::File& SpellcheckHunspellDictionary::GetDictionaryFile() const { 150 const base::File& SpellcheckHunspellDictionary::GetDictionaryFile() const {
151 return dictionary_file_.file; 151 return dictionary_file_.file;
152 } 152 }
153 153
154 const std::string& SpellcheckHunspellDictionary::GetLanguage() const { 154 const std::string& SpellcheckHunspellDictionary::GetLanguage() const {
155 return language_; 155 return language_;
156 } 156 }
157 157
158 bool SpellcheckHunspellDictionary::IsUsingPlatformChecker() const { 158 bool SpellcheckHunspellDictionary::IsUsingPlatformChecker() const {
159 return use_platform_spellchecker_; 159 return use_browser_spellchecker_;
160 } 160 }
161 161
162 void SpellcheckHunspellDictionary::AddObserver(Observer* observer) { 162 void SpellcheckHunspellDictionary::AddObserver(Observer* observer) {
163 DCHECK_CURRENTLY_ON(BrowserThread::UI); 163 DCHECK_CURRENTLY_ON(BrowserThread::UI);
164 observers_.AddObserver(observer); 164 observers_.AddObserver(observer);
165 } 165 }
166 166
167 void SpellcheckHunspellDictionary::RemoveObserver(Observer* observer) { 167 void SpellcheckHunspellDictionary::RemoveObserver(Observer* observer) {
168 DCHECK_CURRENTLY_ON(BrowserThread::UI); 168 DCHECK_CURRENTLY_ON(BrowserThread::UI);
169 observers_.RemoveObserver(observer); 169 observers_.RemoveObserver(observer);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { 359 void SpellcheckHunspellDictionary::InformListenersOfInitialization() {
360 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); 360 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized());
361 } 361 }
362 362
363 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { 363 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() {
364 download_status_ = DOWNLOAD_FAILED; 364 download_status_ = DOWNLOAD_FAILED;
365 FOR_EACH_OBSERVER(Observer, 365 FOR_EACH_OBSERVER(Observer,
366 observers_, 366 observers_,
367 OnHunspellDictionaryDownloadFailure()); 367 OnHunspellDictionaryDownloadFailure());
368 } 368 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h ('k') | chrome/browser/spellchecker/spellcheck_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698