OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ | |
6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ | |
7 | |
8 #include "ipc/ipc_listener.h" | |
9 | |
10 namespace IPC { | |
11 class Message; | |
12 } | |
13 | |
14 namespace content { | |
15 | |
16 class RenderViewHost; | |
17 | |
18 // Browser-side interface responsible for providing CLD data. | |
19 // The implementation must be paired with a renderer-side implementation of | |
20 // the RendererCldDataProvider class: | |
21 // | |
22 // content/public/renderer/renderer_cld_data_provider.h | |
droger
2014/06/19 16:13:18
update the comment.
Andrew Hayden (chromium.org)
2014/06/19 19:49:30
Done.
| |
23 // | |
24 // ... and the glue between them is typically a pair of request/response IPC | |
25 // messages using the CldDataProviderMsgStart IPCMessageStart enumerated | |
26 // constant from ipc_message_start.h | |
27 class BrowserCldDataProvider : public IPC::Listener { | |
droger
2014/06/19 16:13:19
This should be in translate namespace
Andrew Hayden (chromium.org)
2014/06/19 19:49:30
Done.
| |
28 public: | |
29 virtual ~BrowserCldDataProvider() {} | |
30 | |
31 // IPC::Listener implementation: | |
32 // If the specified message is a request for CLD data, invokes | |
33 // OnCldDataRequest() and returns true. In all other cases, this method does | |
34 // nothing. This method is defined as virtual in order to force the | |
35 // implementation to define the specific IPC message(s) that it handles. | |
36 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE; | |
37 | |
38 // Called when the browser process receives an appropriate message in | |
39 // OnMessageReceived, above. The implementation should attempt to locate | |
40 // the CLD data, cache any metadata required for accessing that data, and | |
41 // ultimately trigger a response by invoking SendCldDataResponse. | |
42 // | |
43 // The renderer process may poll for data, in which case this method may be | |
44 // repeatedly invoked. The implementation must be safe to call any number | |
45 // of times. | |
46 virtual void OnCldDataRequest() = 0; | |
47 | |
48 // Invoked when OnCldDataRequest, above, results in a successful lookup or | |
49 // the data is already cached and ready to respond to. The implementation | |
50 // should take whatever action is appropriate for responding to the paired | |
51 // RendererCldDataProvider, typically by sending an IPC response. | |
52 virtual void SendCldDataResponse() = 0; | |
53 }; | |
54 | |
55 // Static factory function defined by the implementation that produces a new | |
56 // provider for the specified render view host. | |
57 BrowserCldDataProvider* CreateBrowserCldDataProviderFor( | |
58 content::RenderViewHost*); | |
59 | |
60 } // namespace content | |
61 | |
62 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATAP_PROVIDER_H_ | |
OLD | NEW |