Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: components/translate/content/browser/browser_cld_data_provider.h

Issue 333603002: Modularize Compact Language Detector 2 (CLD2) data sources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compiler errors Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(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_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_
Takashi Toyoshima 2014/06/19 10:20:34 These macro names should be updated to follow the
Andrew Hayden (chromium.org) 2014/06/19 13:40:19 Done.
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_
7
8 #include "content/public/browser/render_view_host.h"
Takashi Toyoshima 2014/06/19 10:20:34 Forward declaration is enough for content::RenderV
Andrew Hayden (chromium.org) 2014/06/19 13:40:19 Done.
9 #include "ipc/ipc_listener.h"
10 #include "ipc/ipc_message.h"
Takashi Toyoshima 2014/06/19 10:20:34 Forward declaration is enough for IPC::Message.
Andrew Hayden (chromium.org) 2014/06/19 13:40:20 Done.
11
12 namespace content {
13
14 // Browser-side interface responsible for providing CLD data.
15 // The implementation must be paired with a renderer-side implementation of
16 // the RendererCldDataProvider class:
17 //
18 // content/public/renderer/renderer_cld_data_provider.h
19 //
20 // ... and the glue between them is typically a pair of request/response IPC
21 // messages using the CldDataProviderMsgStart IPCMessageStart enumerated
22 // constant from ipc_message_start.h
23 class BrowserCldDataProvider : public IPC::Listener {
24 public:
25 // (Inherited from IPC::Listener)
Takashi Toyoshima 2014/06/19 10:20:34 '<class name> implementation:' is a common style f
Andrew Hayden (chromium.org) 2014/06/19 13:40:19 Done.
26 // If the specified message is a request for CLD data, invokes
27 // OnCldDataRequest() and returns true. In all other cases, this method does
28 // nothing. This method is defined as virtual in order to force the
29 // implementation to define the specific IPC message(s) that it handles.
30 virtual bool OnMessageReceived(const IPC::Message&);
Takashi Toyoshima 2014/06/19 10:20:34 OVERRIDE
Andrew Hayden (chromium.org) 2014/06/19 13:40:20 Done.
31
32 // Called when the browser process receives an appropriate message in
33 // OnMessageReceived, above. The implementation should attempt to locate
34 // the CLD data, cache any metadata required for accessing that data, and
35 // ultimately trigger a response by invoking SendCldDataResponse.
36 //
37 // The renderer process may poll for data, in which case this method may be
38 // repeatedly invoked. The implementation must be safe to call any number
39 // of times.
40 virtual void OnCldDataRequest();
41
42 // Invoked when OnCldDataRequest, above, results in a successful lookup or
43 // the data is already cached and ready to respond to. The implementation
44 // should take whatever action is appropriate for responding to the paired
45 // RendererCldDataProvider, typically by sending an IPC response.
46 virtual void SendCldDataResponse();
47 };
48
49 // Static factory function defined by the implementation that produces a new
Takashi Toyoshima 2014/06/19 10:20:34 Did you build your CL with GYP_DEFINES+="component
Andrew Hayden (chromium.org) 2014/06/19 13:40:19 No, I was just building for my local vanilla Andro
50 // provider for the specified render view host.
51 BrowserCldDataProvider* BrowserCldDataProviderFor(
Takashi Toyoshima 2014/06/19 10:20:34 CreateBrowser...() is better name since it starts
Andrew Hayden (chromium.org) 2014/06/19 13:40:20 Done.
52 content::RenderViewHost*);
53
54 } // namespace content
55
56 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CLD_DATAP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698