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 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ |
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 10 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
11 #include "chrome/common/spellcheck_result.h" | 11 #include "chrome/common/spellcheck_result.h" |
12 #include "content/public/browser/browser_message_filter.h" | 12 #include "content/public/browser/browser_message_filter.h" |
13 | 13 |
14 // A message filter implementation that receives | 14 // A message filter implementation that receives |
15 // the Mac-specific spell checker requests from SpellCheckProvider. | 15 // the Mac-specific spell checker requests from SpellCheckProvider. |
16 class SpellCheckMessageFilterMac : public content::BrowserMessageFilter { | 16 class SpellCheckMessageFilterMac : public content::BrowserMessageFilter { |
17 public: | 17 public: |
18 explicit SpellCheckMessageFilterMac(int render_process_id); | 18 explicit SpellCheckMessageFilterMac(int render_process_id); |
19 | 19 |
20 // BrowserMessageFilter implementation. | 20 // BrowserMessageFilter implementation. |
21 virtual void OverrideThreadForMessage( | 21 virtual void OverrideThreadForMessage( |
22 const IPC::Message& message, | 22 const IPC::Message& message, |
23 content::BrowserThread::ID* thread) OVERRIDE; | 23 content::BrowserThread::ID* thread) OVERRIDE; |
24 virtual bool OnMessageReceived(const IPC::Message& message, | 24 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
25 bool* message_was_ok) OVERRIDE; | |
26 | 25 |
27 // Adjusts remote_results by examining local_results. Any result that's both | 26 // Adjusts remote_results by examining local_results. Any result that's both |
28 // local and remote stays type SPELLING, all others are flagged GRAMMAR. | 27 // local and remote stays type SPELLING, all others are flagged GRAMMAR. |
29 // (This is needed to force gray underline for remote-only results.) | 28 // (This is needed to force gray underline for remote-only results.) |
30 static void CombineResults( | 29 static void CombineResults( |
31 std::vector<SpellCheckResult>* remote_results, | 30 std::vector<SpellCheckResult>* remote_results, |
32 const std::vector<SpellCheckResult>& local_results); | 31 const std::vector<SpellCheckResult>& local_results); |
33 | 32 |
34 private: | 33 private: |
35 friend class TestingSpellCheckMessageFilter; | 34 friend class TestingSpellCheckMessageFilter; |
(...skipping 17 matching lines...) Expand all Loading... |
53 | 52 |
54 int render_process_id_; | 53 int render_process_id_; |
55 | 54 |
56 // A JSON-RPC client that calls the Spelling service in the background. | 55 // A JSON-RPC client that calls the Spelling service in the background. |
57 scoped_ptr<SpellingServiceClient> client_; | 56 scoped_ptr<SpellingServiceClient> client_; |
58 | 57 |
59 DISALLOW_COPY_AND_ASSIGN(SpellCheckMessageFilterMac); | 58 DISALLOW_COPY_AND_ASSIGN(SpellCheckMessageFilterMac); |
60 }; | 59 }; |
61 | 60 |
62 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ | 61 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_MAC_H_ |
OLD | NEW |