OLD | NEW |
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/spellchecker/spellcheck_message_filter.h" | 5 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
6 | 6 |
7 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/spellchecker/spellcheck_host.h" | 9 #include "chrome/browser/spellchecker/spellcheck_host.h" |
10 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 10 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
11 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" | 11 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" |
12 #include "chrome/common/spellcheck_messages.h" | 12 #include "chrome/common/spellcheck_messages.h" |
13 #include "content/browser/renderer_host/render_process_host.h" | 13 #include "content/browser/renderer_host/render_process_host.h" |
14 | 14 |
| 15 using content::BrowserThread; |
| 16 |
15 SpellCheckMessageFilter::SpellCheckMessageFilter(int render_process_id) | 17 SpellCheckMessageFilter::SpellCheckMessageFilter(int render_process_id) |
16 : render_process_id_(render_process_id) { | 18 : render_process_id_(render_process_id) { |
17 } | 19 } |
18 | 20 |
19 SpellCheckMessageFilter::~SpellCheckMessageFilter() { | 21 SpellCheckMessageFilter::~SpellCheckMessageFilter() { |
20 } | 22 } |
21 | 23 |
22 void SpellCheckMessageFilter::OverrideThreadForMessage( | 24 void SpellCheckMessageFilter::OverrideThreadForMessage( |
23 const IPC::Message& message, BrowserThread::ID* thread) { | 25 const IPC::Message& message, BrowserThread::ID* thread) { |
24 if (message.type() == SpellCheckHostMsg_RequestDictionary::ID || | 26 if (message.type() == SpellCheckHostMsg_RequestDictionary::ID || |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool misspelled) { | 117 bool misspelled) { |
116 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); | 118 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); |
117 if (!host) | 119 if (!host) |
118 return; // Teardown. | 120 return; // Teardown. |
119 // Delegates to SpellCheckHost which tracks the stats of our spellchecker. | 121 // Delegates to SpellCheckHost which tracks the stats of our spellchecker. |
120 Profile* profile = Profile::FromBrowserContext(host->browser_context()); | 122 Profile* profile = Profile::FromBrowserContext(host->browser_context()); |
121 SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost(); | 123 SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost(); |
122 if (spellcheck_host && spellcheck_host->GetMetrics()) | 124 if (spellcheck_host && spellcheck_host->GetMetrics()) |
123 spellcheck_host->GetMetrics()->RecordCheckedWordStats(word, misspelled); | 125 spellcheck_host->GetMetrics()->RecordCheckedWordStats(word, misspelled); |
124 } | 126 } |
OLD | NEW |