| 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_message_filter.h" | 5 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 13 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 14 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 14 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
| 15 #include "chrome/browser/spellchecker/spellcheck_service.h" | 15 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 16 #include "chrome/browser/spellchecker/spelling_service_client.h" | 16 #include "chrome/browser/spellchecker/spelling_service_client.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/common/spellcheck_marker.h" | 18 #include "chrome/common/spellcheck_marker.h" |
| 19 #include "chrome/common/spellcheck_messages.h" | 19 #include "chrome/common/spellcheck_messages.h" |
| 20 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
| 21 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
| 22 | 22 |
| 23 using content::BrowserThread; | 23 using content::BrowserThread; |
| 24 | 24 |
| 25 SpellCheckMessageFilter::SpellCheckMessageFilter(int render_process_id) | 25 SpellCheckMessageFilter::SpellCheckMessageFilter(int render_process_id) |
| 26 : BrowserMessageFilter(SpellCheckMsgStart), | 26 : render_process_id_(render_process_id), |
| 27 render_process_id_(render_process_id), | |
| 28 client_(new SpellingServiceClient) { | 27 client_(new SpellingServiceClient) { |
| 29 } | 28 } |
| 30 | 29 |
| 31 void SpellCheckMessageFilter::OverrideThreadForMessage( | 30 void SpellCheckMessageFilter::OverrideThreadForMessage( |
| 32 const IPC::Message& message, BrowserThread::ID* thread) { | 31 const IPC::Message& message, BrowserThread::ID* thread) { |
| 33 // IPC messages arrive on IO thread, but spellcheck data lives on UI thread. | 32 // IPC messages arrive on IO thread, but spellcheck data lives on UI thread. |
| 34 // The message filter overrides the thread for these messages because they | 33 // The message filter overrides the thread for these messages because they |
| 35 // access spellcheck data. | 34 // access spellcheck data. |
| 36 if (message.type() == SpellCheckHostMsg_RequestDictionary::ID || | 35 if (message.type() == SpellCheckHostMsg_RequestDictionary::ID || |
| 37 message.type() == SpellCheckHostMsg_NotifyChecked::ID || | 36 message.type() == SpellCheckHostMsg_NotifyChecked::ID || |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 base::Unretained(this), | 181 base::Unretained(this), |
| 183 route_id, | 182 route_id, |
| 184 identifier, | 183 identifier, |
| 185 markers)); | 184 markers)); |
| 186 } | 185 } |
| 187 #endif | 186 #endif |
| 188 | 187 |
| 189 SpellcheckService* SpellCheckMessageFilter::GetSpellcheckService() const { | 188 SpellcheckService* SpellCheckMessageFilter::GetSpellcheckService() const { |
| 190 return SpellcheckServiceFactory::GetForRenderProcessId(render_process_id_); | 189 return SpellcheckServiceFactory::GetForRenderProcessId(render_process_id_); |
| 191 } | 190 } |
| OLD | NEW |