| 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_H_ | 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_ |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_ | 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/spellchecker/spelling_service_client.h" | 12 #include "chrome/browser/spellchecker/spelling_service_client.h" |
| 11 #include "content/public/browser/browser_message_filter.h" | 13 #include "content/public/browser/browser_message_filter.h" |
| 12 | 14 |
| 13 class SpellCheckMarker; | 15 class SpellCheckMarker; |
| 14 class SpellcheckService; | 16 class SpellcheckService; |
| 15 struct SpellCheckResult; | 17 struct SpellCheckResult; |
| 16 | 18 |
| 17 // A message filter implementation that receives spell checker requests from | 19 // A message filter implementation that receives spell checker requests from |
| 18 // SpellCheckProvider. | 20 // SpellCheckProvider. |
| 19 class SpellCheckMessageFilter : public content::BrowserMessageFilter { | 21 class SpellCheckMessageFilter : public content::BrowserMessageFilter { |
| 20 public: | 22 public: |
| 21 explicit SpellCheckMessageFilter(int render_process_id); | 23 explicit SpellCheckMessageFilter(int render_process_id); |
| 22 | 24 |
| 23 // content::BrowserMessageFilter implementation. | 25 // content::BrowserMessageFilter implementation. |
| 24 void OverrideThreadForMessage(const IPC::Message& message, | 26 void OverrideThreadForMessage(const IPC::Message& message, |
| 25 content::BrowserThread::ID* thread) override; | 27 content::BrowserThread::ID* thread) override; |
| 26 bool OnMessageReceived(const IPC::Message& message) override; | 28 bool OnMessageReceived(const IPC::Message& message) override; |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 friend class TestingSpellCheckMessageFilter; | 31 friend class TestingSpellCheckMessageFilter; |
| 30 | 32 |
| 31 ~SpellCheckMessageFilter() override; | 33 ~SpellCheckMessageFilter() override; |
| 32 | 34 |
| 33 void OnSpellCheckerRequestDictionary(); | 35 void OnSpellCheckerRequestDictionary(); |
| 34 void OnNotifyChecked(const base::string16& word, bool misspelled); | 36 void OnNotifyChecked(const base::string16& word, bool misspelled); |
| 35 void OnRespondDocumentMarkers(const std::vector<uint32>& markers); | 37 void OnRespondDocumentMarkers(const std::vector<uint32_t>& markers); |
| 36 #if !defined(USE_BROWSER_SPELLCHECKER) | 38 #if !defined(USE_BROWSER_SPELLCHECKER) |
| 37 void OnCallSpellingService(int route_id, | 39 void OnCallSpellingService(int route_id, |
| 38 int identifier, | 40 int identifier, |
| 39 const base::string16& text, | 41 const base::string16& text, |
| 40 std::vector<SpellCheckMarker> markers); | 42 std::vector<SpellCheckMarker> markers); |
| 41 | 43 |
| 42 // A callback function called when the Spelling service finishes checking | 44 // A callback function called when the Spelling service finishes checking |
| 43 // text. Sends the given results to a renderer. | 45 // text. Sends the given results to a renderer. |
| 44 void OnTextCheckComplete( | 46 void OnTextCheckComplete( |
| 45 int route_id, | 47 int route_id, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 // Can be overridden for testing. | 67 // Can be overridden for testing. |
| 66 virtual SpellcheckService* GetSpellcheckService() const; | 68 virtual SpellcheckService* GetSpellcheckService() const; |
| 67 | 69 |
| 68 int render_process_id_; | 70 int render_process_id_; |
| 69 | 71 |
| 70 // A JSON-RPC client that calls the Spelling service in the background. | 72 // A JSON-RPC client that calls the Spelling service in the background. |
| 71 scoped_ptr<SpellingServiceClient> client_; | 73 scoped_ptr<SpellingServiceClient> client_; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_ | 76 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_ |
| OLD | NEW |