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

Side by Side Diff: chrome/browser/spellcheck_host_impl.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
« no previous file with comments | « chrome/browser/spellcheck_host_impl.h ('k') | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/spellcheck_host_impl.h" 5 #include "chrome/browser/spellcheck_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 request_context_getter_(request_context_getter), 92 request_context_getter_(request_context_getter),
93 metrics_(metrics) { 93 metrics_(metrics) {
94 DCHECK(observer_); 94 DCHECK(observer_);
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
96 96
97 FilePath personal_file_directory; 97 FilePath personal_file_directory;
98 PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory); 98 PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory);
99 custom_dictionary_file_ = 99 custom_dictionary_file_ =
100 personal_file_directory.Append(chrome::kCustomDictionaryFileName); 100 personal_file_directory.Append(chrome::kCustomDictionaryFileName);
101 101
102 registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, 102 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
103 NotificationService::AllSources()); 103 NotificationService::AllSources());
104 } 104 }
105 105
106 SpellCheckHostImpl::~SpellCheckHostImpl() { 106 SpellCheckHostImpl::~SpellCheckHostImpl() {
107 if (file_ != base::kInvalidPlatformFileValue) 107 if (file_ != base::kInvalidPlatformFileValue)
108 base::ClosePlatformFile(file_); 108 base::ClosePlatformFile(file_);
109 } 109 }
110 110
111 void SpellCheckHostImpl::Initialize() { 111 void SpellCheckHostImpl::Initialize() {
112 if (SpellCheckerPlatform::SpellCheckerAvailable() && 112 if (SpellCheckerPlatform::SpellCheckerAvailable() &&
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 LOG(ERROR) << "Failure to download dictionary."; 326 LOG(ERROR) << "Failure to download dictionary.";
327 InitializeOnFileThread(); 327 InitializeOnFileThread();
328 return; 328 return;
329 } 329 }
330 330
331 data_ = data; 331 data_ = data;
332 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 332 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
333 NewRunnableMethod(this, &SpellCheckHostImpl::SaveDictionaryData)); 333 NewRunnableMethod(this, &SpellCheckHostImpl::SaveDictionaryData));
334 } 334 }
335 335
336 void SpellCheckHostImpl::Observe(NotificationType type, 336 void SpellCheckHostImpl::Observe(int type,
337 const NotificationSource& source, 337 const NotificationSource& source,
338 const NotificationDetails& details) { 338 const NotificationDetails& details) {
339 DCHECK(type == NotificationType::RENDERER_PROCESS_CREATED); 339 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CREATED);
340 RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); 340 RenderProcessHost* process = Source<RenderProcessHost>(source).ptr();
341 InitForRenderer(process); 341 InitForRenderer(process);
342 } 342 }
343 343
344 void SpellCheckHostImpl::SaveDictionaryData() { 344 void SpellCheckHostImpl::SaveDictionaryData() {
345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
346 346
347 // To prevent corrupted dictionary data from causing a renderer crash, scan 347 // To prevent corrupted dictionary data from causing a renderer crash, scan
348 // the dictionary data and verify it is sane before save it to a file. 348 // the dictionary data and verify it is sane before save it to a file.
349 bool verified = hunspell::BDict::Verify(data_.data(), data_.size()); 349 bool verified = hunspell::BDict::Verify(data_.data(), data_.size());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return custom_words_.back(); 403 return custom_words_.back();
404 } 404 }
405 405
406 const std::string& SpellCheckHostImpl::GetLanguage() const { 406 const std::string& SpellCheckHostImpl::GetLanguage() const {
407 return language_; 407 return language_;
408 } 408 }
409 409
410 bool SpellCheckHostImpl::IsUsingPlatformChecker() const { 410 bool SpellCheckHostImpl::IsUsingPlatformChecker() const {
411 return use_platform_spellchecker_; 411 return use_platform_spellchecker_;
412 } 412 }
OLDNEW
« no previous file with comments | « chrome/browser/spellcheck_host_impl.h ('k') | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698