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/spellchecker/spellcheck_message_filter.h

Issue 2857353002: Convert Spellcheck host MessageFilter IPC to mojo (Closed)
Patch Set: Use MakeUnique for the MessageLoop in TestingSpellCheckProvider. Created 3 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11
12 #include "base/compiler_specific.h"
13 #include "components/spellcheck/browser/spelling_service_client.h"
14 #include "components/spellcheck/spellcheck_build_features.h"
15 #include "content/public/browser/browser_message_filter.h"
16
17 class SpellcheckService;
18 struct SpellCheckResult;
19
20 // A message filter implementation that receives spell checker requests from
21 // SpellCheckProvider.
22 class SpellCheckMessageFilter : public content::BrowserMessageFilter {
23 public:
24 explicit SpellCheckMessageFilter(int render_process_id);
25
26 // content::BrowserMessageFilter implementation.
27 void OverrideThreadForMessage(const IPC::Message& message,
28 content::BrowserThread::ID* thread) override;
29 bool OnMessageReceived(const IPC::Message& message) override;
30
31 private:
32 friend class TestingSpellCheckMessageFilter;
33
34 ~SpellCheckMessageFilter() override;
35
36 void OnSpellCheckerRequestDictionary();
37 void OnNotifyChecked(const base::string16& word, bool misspelled);
38 #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER)
39 void OnCallSpellingService(int route_id,
40 int identifier,
41 const base::string16& text);
42
43 // A callback function called when the Spelling service finishes checking
44 // text. Sends the given results to a renderer.
45 void OnTextCheckComplete(
46 int route_id,
47 int identifier,
48 bool success,
49 const base::string16& text,
50 const std::vector<SpellCheckResult>& results);
51
52 // Checks the user profile and sends a JSON-RPC request to the Spelling
53 // service if a user enables the "Ask Google for suggestions" option. When we
54 // receive a response (including an error) from the service, it calls
55 // OnTextCheckComplete. When this function is called before we receive a
56 // response for the previous request, this function cancels the previous
57 // request and sends a new one.
58 void CallSpellingService(const base::string16& text,
59 int route_id,
60 int identifier);
61 #endif
62
63 // Can be overridden for testing.
64 virtual SpellcheckService* GetSpellcheckService() const;
65
66 int render_process_id_;
67
68 // A JSON-RPC client that calls the Spelling service in the background.
69 std::unique_ptr<SpellingServiceClient> client_;
70 };
71
72 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_host_impl_unittest.cc ('k') | chrome/browser/spellchecker/spellcheck_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698