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

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

Issue 2177343002: Componentize spellcheck [2]: move common/ files to component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move message generator to component Created 4 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "chrome/browser/spellchecker/spellcheck_platform.h" 18 #include "chrome/browser/spellchecker/spellcheck_platform.h"
19 #include "chrome/browser/spellchecker/spellcheck_service.h" 19 #include "chrome/browser/spellchecker/spellcheck_service.h"
20 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/spellcheck_common.h"
22 #include "components/data_use_measurement/core/data_use_user_data.h" 21 #include "components/data_use_measurement/core/data_use_user_data.h"
22 #include "components/spellcheck/common/spellcheck_common.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
25 #include "net/base/load_flags.h" 25 #include "net/base/load_flags.h"
26 #include "net/url_request/url_fetcher.h" 26 #include "net/url_request/url_fetcher.h"
27 #include "net/url_request/url_request_context_getter.h" 27 #include "net/url_request/url_request_context_getter.h"
28 #include "url/gurl.h" 28 #include "url/gurl.h"
29 29
30 #if !defined(OS_ANDROID) 30 #if !defined(OS_ANDROID)
31 #include "base/files/memory_mapped_file.h" 31 #include "base/files/memory_mapped_file.h"
32 #include "third_party/hunspell/google/bdict.h" 32 #include "third_party/hunspell/google/bdict.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 SpellcheckHunspellDictionary::DictionaryFile 317 SpellcheckHunspellDictionary::DictionaryFile
318 SpellcheckHunspellDictionary::InitializeDictionaryLocation( 318 SpellcheckHunspellDictionary::InitializeDictionaryLocation(
319 const std::string& language) { 319 const std::string& language) {
320 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 320 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
321 321
322 // Initialize the BDICT path. Initialization should be in the FILE thread 322 // Initialize the BDICT path. Initialization should be in the FILE thread
323 // because it checks if there is a "Dictionaries" directory and create it. 323 // because it checks if there is a "Dictionaries" directory and create it.
324 base::FilePath dict_dir; 324 base::FilePath dict_dir;
325 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); 325 PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir);
326 base::FilePath dict_path = 326 base::FilePath dict_path =
327 chrome::spellcheck_common::GetVersionedFileName(language, dict_dir); 327 spellcheck::GetVersionedFileName(language, dict_dir);
328 328
329 return OpenDictionaryFile(dict_path); 329 return OpenDictionaryFile(dict_path);
330 } 330 }
331 331
332 void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete( 332 void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete(
333 DictionaryFile file) { 333 DictionaryFile file) {
334 DCHECK_CURRENTLY_ON(BrowserThread::UI); 334 DCHECK_CURRENTLY_ON(BrowserThread::UI);
335 dictionary_file_ = std::move(file); 335 dictionary_file_ = std::move(file);
336 336
337 if (!dictionary_file_.file.IsValid()) { 337 if (!dictionary_file_.file.IsValid()) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 FOR_EACH_OBSERVER(Observer, observers_, 374 FOR_EACH_OBSERVER(Observer, observers_,
375 OnHunspellDictionaryInitialized(language_)); 375 OnHunspellDictionaryInitialized(language_));
376 } 376 }
377 377
378 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { 378 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() {
379 download_status_ = DOWNLOAD_FAILED; 379 download_status_ = DOWNLOAD_FAILED;
380 FOR_EACH_OBSERVER(Observer, 380 FOR_EACH_OBSERVER(Observer,
381 observers_, 381 observers_,
382 OnHunspellDictionaryDownloadFailure(language_)); 382 OnHunspellDictionaryDownloadFailure(language_));
383 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698