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

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

Issue 2034413003: Delete the non-static CLD data source logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest master Created 4 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
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 // NOT DEAD CODE!
6 // This code isn't dead, even if it isn't currently being used. Please refer to:
7 // https://www.chromium.org/developers/how-tos/compact-language-detector-cld-dat a-source-configuration
8
9 #ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_
10 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_
11
12 #include <string>
13
14 #include "base/compiler_specific.h"
15 #include "base/macros.h"
16 #include "ipc/ipc_listener.h"
17
18 namespace IPC {
19 class Message;
20 }
21
22 namespace translate {
23
24 // Browser-side interface responsible for providing CLD data.
25 // The implementation must be paired with a renderer-side implementation of
26 // the RendererCldDataProvider class:
27 // ../renderer/renderer_cld_data_provider.h
28 //
29 // The glue between them is typically a pair of request/response IPC messages
30 // using the "CldDataProviderMsgStart" IPCMessageStart enumerated constant from
31 // ipc_message_start.h
32 //
33 // In general, instances of this class should be obtained by using the
34 // BrowserCldDataProviderFactory::CreateBrowserCldProvider(...). For more
35 // information, see browser_cld_data_provider_factory.h.
36 class BrowserCldDataProvider : public IPC::Listener {
37 public:
38 BrowserCldDataProvider() {}
39 ~BrowserCldDataProvider() override {}
40
41 // IPC::Listener implementation:
42 // If the specified message is a request for CLD data, invokes
43 // OnCldDataRequest() and returns true. In all other cases, this method does
44 // nothing. This method is defined as virtual in order to force the
45 // implementation to define the specific IPC message(s) that it handles.
46 // The default implementation does nothing and returns false.
47 bool OnMessageReceived(const IPC::Message&) override;
48
49 // Called when the browser process receives an appropriate message in
50 // OnMessageReceived, above. The implementation should attempt to locate
51 // the CLD data, cache any metadata required for accessing that data, and
52 // ultimately trigger a response by invoking SendCldDataResponse.
53 // The renderer process may poll for data, in which case this method may be
54 // repeatedly invoked. The implementation must be safe to call any number
55 // of times.
56 // The default implementation does nothing.
57 virtual void OnCldDataRequest() {}
58
59 // Invoked when OnCldDataRequest, above, results in a successful lookup or
60 // the data is already cached and ready to respond to. The implementation
61 // should take whatever action is appropriate for responding to the paired
62 // RendererCldDataProvider, typically by sending an IPC response.
63 // The default implementation does nothing.
64 virtual void SendCldDataResponse() {}
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(BrowserCldDataProvider);
68 };
69
70 } // namespace translate
71
72 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/translate/content/browser/BUILD.gn ('k') | components/translate/content/browser/browser_cld_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698