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 CONTENT_PUBLIC_RENDERER_RENDERER_CLD_DATA_PROVIDER_H_ | |
6 #define CONTENT_PUBLIC_RENDERER_RENDERER_CLD_DATA_PROVIDER_H_ | |
Takashi Toyoshima
2014/06/19 10:20:35
macro name
Andrew Hayden (chromium.org)
2014/06/19 13:40:20
Done.
| |
7 | |
8 #include "base/callback.h" | |
9 #include "content/public/renderer/render_view_observer.h" | |
10 #include "ipc/ipc_listener.h" | |
11 #include "ipc/ipc_message.h" | |
12 | |
13 namespace content { | |
14 | |
15 // Renderer-side interface responsible for providing CLD data. | |
16 // The implementation must be paired with a browser-side implementation of | |
17 // the BrowserCldDataProvider class: | |
18 // | |
19 // content/public/browser/browser_cld_data_provider.h | |
20 // | |
21 // ... and the glue between them is typically a pair of request/response IPC | |
22 // messages using the CldDataProviderMsgStart IPCMessageStart enumerated | |
23 // constant from ipc_message_start.h | |
24 class RendererCldDataProvider : public IPC::Listener { | |
25 public: | |
26 // (Inherited from IPC::Listener) | |
27 // If the specified message is a response for CLD data, attempts to | |
28 // initialize CLD2 and returns true in all cases. If initialization is | |
29 // successful and a callback has been configured via | |
30 // SetCldAvailableCallback(...), that callback is invoked from the message | |
31 // loop thread. | |
32 // This method is defined as virtual in order to force the implementation to | |
33 // define the specific IPC message(s) that it handles. | |
34 virtual bool OnMessageReceived(const IPC::Message&) = 0; | |
35 | |
36 // Invoked by the renderer process to request that CLD data be obtained and | |
37 // that CLD be initialized with it. The implementation is expected to | |
38 // communicate with the paired BrowserCldDataProvider implementation on the | |
39 // browser side. | |
40 // This method must be invoked on the message loop thread. | |
41 virtual void SendCldDataRequest() = 0; | |
42 | |
43 // Convenience method that tracks whether or not CLD data is available. | |
44 // This method can be used in the absence of a callback (i.e., if the caller | |
45 // wants a simple way to check the state of CLD data availability without | |
46 // keeping a separate boolean flag tripped by a callback). | |
47 virtual bool IsCldDataAvailable() = 0; | |
48 | |
49 // Sets a callback that will be invoked when CLD data is successfully | |
50 // obtained from the paired BrowserCldDataProvider implementation on the | |
51 // browser side, after CLD has been successfully initialized. | |
52 // Both the initialization of CLD2 as well as the invocation of the callback | |
53 // must happen on the message loop thread. | |
54 virtual void SetCldAvailableCallback(base::Callback<void(void)>) = 0; | |
55 }; | |
56 | |
57 // Static factory function defined by the implementation that produces a new | |
58 // provider for the specified render view host. | |
59 RendererCldDataProvider* RendererCldDataProviderFor( | |
Takashi Toyoshima
2014/06/19 10:20:35
CreateRendererCldDataProviderFor()
Andrew Hayden (chromium.org)
2014/06/19 13:40:20
Done.
| |
60 content::RenderViewObserver*); | |
61 | |
62 } // namespace content | |
63 | |
64 #endif // CONTENT_PUBLIC_RENDERER_RENDERER_CLD_DATAP_PROVIDER_H_ | |
OLD | NEW |