OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |
6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ | 6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |
7 | 7 |
8 #include <string> | |
9 | |
8 #include "ipc/ipc_listener.h" | 10 #include "ipc/ipc_listener.h" |
9 | 11 |
10 namespace IPC { | 12 namespace IPC { |
11 class Message; | 13 class Message; |
12 } | 14 } |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 class WebContents; | 17 class WebContents; |
16 } | 18 } |
17 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 // should take whatever action is appropriate for responding to the paired | 54 // should take whatever action is appropriate for responding to the paired |
53 // RendererCldDataProvider, typically by sending an IPC response. | 55 // RendererCldDataProvider, typically by sending an IPC response. |
54 virtual void SendCldDataResponse() = 0; | 56 virtual void SendCldDataResponse() = 0; |
55 }; | 57 }; |
56 | 58 |
57 // Static factory function defined by the implementation that produces a new | 59 // Static factory function defined by the implementation that produces a new |
58 // provider for the specified WebContents. | 60 // provider for the specified WebContents. |
59 BrowserCldDataProvider* CreateBrowserCldDataProviderFor( | 61 BrowserCldDataProvider* CreateBrowserCldDataProviderFor( |
60 content::WebContents*); | 62 content::WebContents*); |
61 | 63 |
64 // Allows passing an implementation-specific configuration object to the data | |
65 // source. Since it is not possible to know at compile time which data source | |
66 // is being linked into the runtime, there can be no specific data type other | |
67 // than a raw pointer. The caller retains ownership of the pointer (the | |
68 // implementation should make an independent copy of the data if necessary). | |
69 // | |
70 // The 'static' CLD data source implements this as a no-op. | |
71 // The 'component' and 'standalone' data sources implement this expecting a | |
72 // pointer to a base::FilePath representing the path to a CLD data file. | |
73 // Other data sources may implement this arbitrarily. | |
74 // | |
75 // This method is provided so that code living outside of the /components | |
76 // source tree can configure data sources without having to depend directly | |
77 // upon a specific implementation, greatly simplifying build logic and | |
78 // linking; the cost is type safety. Callers should first check the run-time | |
79 // type of CLD data source configured (via CldDataSource::GetName()) and | |
80 // ensure that the correct type of object is passed. | |
jam
2014/07/29 19:51:27
this seems a bit odd and fragile. Can an abstract
| |
81 void ConfigureBrowserCldDataProvider(const void* config); | |
82 | |
62 } // namespace translate | 83 } // namespace translate |
63 | 84 |
64 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATAP_PROVIDER_H_ | 85 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_ |
OLD | NEW |