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 "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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { | 73 SpellcheckHunspellDictionary::DictionaryFile::~DictionaryFile() { |
74 if (file.IsValid()) { | 74 if (file.IsValid()) { |
75 BrowserThread::PostTask( | 75 BrowserThread::PostTask( |
76 BrowserThread::FILE, | 76 BrowserThread::FILE, |
77 FROM_HERE, | 77 FROM_HERE, |
78 base::Bind(&CloseDictionary, Passed(&file))); | 78 base::Bind(&CloseDictionary, Passed(&file))); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile(RValue other) | 82 SpellcheckHunspellDictionary::DictionaryFile::DictionaryFile( |
83 : path(other.object->path), | 83 DictionaryFile&& other) |
84 file(other.object->file.Pass()) { | 84 : path(other.path), file(other.file.Pass()) {} |
85 } | |
86 | 85 |
87 SpellcheckHunspellDictionary::DictionaryFile& | 86 SpellcheckHunspellDictionary::DictionaryFile& |
88 SpellcheckHunspellDictionary::DictionaryFile::operator=(RValue other) { | 87 SpellcheckHunspellDictionary::DictionaryFile:: |
89 if (this != other.object) { | 88 operator=(DictionaryFile&& other) { |
90 path = other.object->path; | 89 path = other.path; |
91 file = other.object->file.Pass(); | 90 file = other.file.Pass(); |
92 } | |
93 return *this; | 91 return *this; |
94 } | 92 } |
95 | 93 |
96 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( | 94 SpellcheckHunspellDictionary::SpellcheckHunspellDictionary( |
97 const std::string& language, | 95 const std::string& language, |
98 net::URLRequestContextGetter* request_context_getter, | 96 net::URLRequestContextGetter* request_context_getter, |
99 SpellcheckService* spellcheck_service) | 97 SpellcheckService* spellcheck_service) |
100 : language_(language), | 98 : language_(language), |
101 use_browser_spellchecker_(false), | 99 use_browser_spellchecker_(false), |
102 request_context_getter_(request_context_getter), | 100 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_, | 366 FOR_EACH_OBSERVER(Observer, observers_, |
369 OnHunspellDictionaryInitialized(language_)); | 367 OnHunspellDictionaryInitialized(language_)); |
370 } | 368 } |
371 | 369 |
372 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { | 370 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { |
373 download_status_ = DOWNLOAD_FAILED; | 371 download_status_ = DOWNLOAD_FAILED; |
374 FOR_EACH_OBSERVER(Observer, | 372 FOR_EACH_OBSERVER(Observer, |
375 observers_, | 373 observers_, |
376 OnHunspellDictionaryDownloadFailure(language_)); | 374 OnHunspellDictionaryDownloadFailure(language_)); |
377 } | 375 } |
OLD | NEW |