| OLD | NEW |
| 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 <utility> |
| 8 |
| 7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 11 #include "chrome/browser/spellchecker/spellcheck_platform.h" | 13 #include "chrome/browser/spellchecker/spellcheck_platform.h" |
| 12 #include "chrome/browser/spellchecker/spellcheck_service.h" | 14 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 13 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/spellcheck_common.h" | 16 #include "chrome/common/spellcheck_common.h" |
| 15 #include "components/data_use_measurement/core/data_use_user_data.h" | 17 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 16 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 74 |
| 73 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { | 75 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { |
| 74 if (file.IsValid()) { | 76 if (file.IsValid()) { |
| 75 BrowserThread::PostTask( | 77 BrowserThread::PostTask( |
| 76 BrowserThread::FILE, | 78 BrowserThread::FILE, |
| 77 FROM_HERE, | 79 FROM_HERE, |
| 78 base::Bind(&CloseDictionary, Passed(&file))); | 80 base::Bind(&CloseDictionary, Passed(&file))); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 | 83 |
| 82 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile(RValue other) | 84 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile( |
| 83 : path(other.object->path), | 85 DictionaryFile&& other) |
| 84 file(other.object->file.Pass()) { | 86 : path(other.path), file(std::move(other.file)) {} |
| 85 } | |
| 86 | 87 |
| 87 SpellcheckHunspellDictionary::DictionaryFile& | 88 SpellcheckHunspellDictionary::DictionaryFile& |
| 88 SpellcheckHunspellDictionary::DictionaryFile::operator=(RValue other) { | 89 SpellcheckHunspellDictionary::DictionaryFile:: |
| 89 if (this != other.object) { | 90 operator=(DictionaryFile&& other) { |
| 90 path = other.object->path; | 91 path = other.path; |
| 91 file = other.object->file.Pass(); | 92 file = std::move(other.file); |
| 92 } | |
| 93 return *this; | 93 return *this; |
| 94 } | 94 } |
| 95 | 95 |
| 96 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( | 96 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( |
| 97 const std::string& language, | 97 const std::string& language, |
| 98 net::URLRequestContextGetter* request_context_getter, | 98 net::URLRequestContextGetter* request_context_getter, |
| 99 SpellcheckService* spellcheck_service) | 99 SpellcheckService* spellcheck_service) |
| 100 : language_(language), | 100 : language_(language), |
| 101 use_browser_spellchecker_(false), | 101 use_browser_spellchecker_(false), |
| 102 request_context_getter_(request_context_getter), | 102 request_context_getter_(request_context_getter), |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 FOR_EACH_OBSERVER(Observer, observers_, | 368 FOR_EACH_OBSERVER(Observer, observers_, |
| 369 OnHunspellDictionaryInitialized(language_)); | 369 OnHunspellDictionaryInitialized(language_)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { | 372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { |
| 373 download_status_ = DOWNLOAD_FAILED; | 373 download_status_ = DOWNLOAD_FAILED; |
| 374 FOR_EACH_OBSERVER(Observer, | 374 FOR_EACH_OBSERVER(Observer, |
| 375 observers_, | 375 observers_, |
| 376 OnHunspellDictionaryDownloadFailure(language_)); | 376 OnHunspellDictionaryDownloadFailure(language_)); |
| 377 } | 377 } |
| OLD | NEW |