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_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID
ER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID
ER_H_ |
6 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID
ER_H_ | 6 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID
ER_H_ |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/translate/content/renderer/renderer_cld_data_provider.h" | 10 #include "components/translate/content/renderer/renderer_cld_data_provider.h" |
11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
12 | 12 |
| 13 namespace content { |
| 14 class RenderViewObserver; |
| 15 } |
| 16 |
13 namespace translate { | 17 namespace translate { |
14 | 18 |
15 class DataFileRendererCldDataProvider : public RendererCldDataProvider { | 19 class DataFileRendererCldDataProvider : public RendererCldDataProvider { |
16 public: | 20 public: |
17 explicit DataFileRendererCldDataProvider(content::RenderViewObserver*); | 21 explicit DataFileRendererCldDataProvider(content::RenderViewObserver*); |
18 virtual ~DataFileRendererCldDataProvider(); | 22 ~DataFileRendererCldDataProvider() override; |
| 23 |
19 // RendererCldDataProvider implementations: | 24 // RendererCldDataProvider implementations: |
20 virtual bool OnMessageReceived(const IPC::Message&) override; | 25 bool OnMessageReceived(const IPC::Message&) override; |
21 virtual void SendCldDataRequest() override; | 26 void SendCldDataRequest() override; |
22 virtual void SetCldAvailableCallback(base::Callback<void(void)>) override; | 27 void SetCldAvailableCallback(base::Callback<void(void)>) override; |
23 virtual bool IsCldDataAvailable() override; | 28 bool IsCldDataAvailable() override; |
24 | 29 |
25 private: | 30 private: |
26 void OnCldDataAvailable(const IPC::PlatformFileForTransit ipc_file_handle, | 31 void OnCldDataAvailable(const IPC::PlatformFileForTransit ipc_file_handle, |
27 const uint64 data_offset, | 32 const uint64 data_offset, |
28 const uint64 data_length); | 33 const uint64 data_length); |
29 void LoadCldData(base::File file, | 34 void LoadCldData(base::File file, |
30 const uint64 data_offset, | 35 const uint64 data_offset, |
31 const uint64 data_length); | 36 const uint64 data_length); |
32 content::RenderViewObserver* render_view_observer_; | 37 content::RenderViewObserver* render_view_observer_; |
33 base::Callback<void(void)> cld_available_callback_; | 38 base::Callback<void(void)> cld_available_callback_; |
34 | 39 |
35 DISALLOW_COPY_AND_ASSIGN(DataFileRendererCldDataProvider); | 40 DISALLOW_COPY_AND_ASSIGN(DataFileRendererCldDataProvider); |
36 }; | 41 }; |
37 | 42 |
38 } // namespace translate | 43 } // namespace translate |
39 | 44 |
40 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PRO
VIDER_H_ | 45 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PRO
VIDER_H_ |
OLD | NEW |