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_host_impl.h" | 5 #include "chrome/browser/spellchecker/spellcheck_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 void SpellCheckHostImpl::WriteWordToCustomDictionary(const std::string& word) { | 317 void SpellCheckHostImpl::WriteWordToCustomDictionary(const std::string& word) { |
318 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 318 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
319 | 319 |
320 if (profile_) | 320 if (profile_) |
321 profile_->WriteWordToCustomDictionary(word); | 321 profile_->WriteWordToCustomDictionary(word); |
322 } | 322 } |
323 | 323 |
324 void SpellCheckHostImpl::OnURLFetchComplete(const net::URLFetcher* source) { | 324 void SpellCheckHostImpl::OnURLFetchComplete(const net::URLFetcher* source) { |
325 DCHECK(source); | 325 DCHECK(source); |
326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
327 scoped_ptr<content::URLFetcher> fetcher_destructor(fetcher_.release()); | 327 scoped_ptr<net::URLFetcher> fetcher_destructor(fetcher_.release()); |
328 | 328 |
329 if ((source->GetResponseCode() / 100) != 2) { | 329 if ((source->GetResponseCode() / 100) != 2) { |
330 // Initialize will not try to download the file a second time. | 330 // Initialize will not try to download the file a second time. |
331 LOG(ERROR) << "Failure to download dictionary."; | 331 LOG(ERROR) << "Failure to download dictionary."; |
332 return; | 332 return; |
333 } | 333 } |
334 | 334 |
335 // Basic sanity check on the dictionary. | 335 // Basic sanity check on the dictionary. |
336 // There's the small chance that we might see a 200 status code for a body | 336 // There's the small chance that we might see a 200 status code for a body |
337 // that represents some form of failure. | 337 // that represents some form of failure. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { | 451 void SpellCheckHostImpl::AddWordComplete(const std::string& word) { |
452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
453 | 453 |
454 for (content::RenderProcessHost::iterator i( | 454 for (content::RenderProcessHost::iterator i( |
455 content::RenderProcessHost::AllHostsIterator()); | 455 content::RenderProcessHost::AllHostsIterator()); |
456 !i.IsAtEnd(); i.Advance()) { | 456 !i.IsAtEnd(); i.Advance()) { |
457 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); | 457 i.GetCurrentValue()->Send(new SpellCheckMsg_WordAdded(word)); |
458 } | 458 } |
459 } | 459 } |
OLD | NEW |