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

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

Issue 320513002: Remove base::kInvalidPlatformFileValue from Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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) 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/memory_mapped_file.h" 8 #include "base/files/memory_mapped_file.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 132
133 void SpellcheckHunspellDictionary::RetryDownloadDictionary( 133 void SpellcheckHunspellDictionary::RetryDownloadDictionary(
134 net::URLRequestContextGetter* request_context_getter) { 134 net::URLRequestContextGetter* request_context_getter) {
135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
136 request_context_getter_ = request_context_getter; 136 request_context_getter_ = request_context_getter;
137 DownloadDictionary(GetDictionaryURL()); 137 DownloadDictionary(GetDictionaryURL());
138 } 138 }
139 139
140 bool SpellcheckHunspellDictionary::IsReady() const { 140 bool SpellcheckHunspellDictionary::IsReady() const {
141 return GetDictionaryFile() != 141 return GetDictionaryFile().IsValid() || IsUsingPlatformChecker();
142 base::kInvalidPlatformFileValue || IsUsingPlatformChecker();
143 } 142 }
144 143
145 base::PlatformFile SpellcheckHunspellDictionary::GetDictionaryFile() const { 144 const base::File& SpellcheckHunspellDictionary::GetDictionaryFile() const {
146 return dictionary_file_.file.GetPlatformFile(); 145 return dictionary_file_.file;
147 } 146 }
148 147
149 const std::string& SpellcheckHunspellDictionary::GetLanguage() const { 148 const std::string& SpellcheckHunspellDictionary::GetLanguage() const {
150 return language_; 149 return language_;
151 } 150 }
152 151
153 bool SpellcheckHunspellDictionary::IsUsingPlatformChecker() const { 152 bool SpellcheckHunspellDictionary::IsUsingPlatformChecker() const {
154 return use_platform_spellchecker_; 153 return use_platform_spellchecker_;
155 } 154 }
156 155
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void SpellcheckHunspellDictionary::InformListenersOfInitialization() { 348 void SpellcheckHunspellDictionary::InformListenersOfInitialization() {
350 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized()); 349 FOR_EACH_OBSERVER(Observer, observers_, OnHunspellDictionaryInitialized());
351 } 350 }
352 351
353 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() { 352 void SpellcheckHunspellDictionary::InformListenersOfDownloadFailure() {
354 download_status_ = DOWNLOAD_FAILED; 353 download_status_ = DOWNLOAD_FAILED;
355 FOR_EACH_OBSERVER(Observer, 354 FOR_EACH_OBSERVER(Observer,
356 observers_, 355 observers_,
357 OnHunspellDictionaryDownloadFailure()); 356 OnHunspellDictionaryDownloadFailure());
358 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698