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.
5 #ifndef COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVIDER_H_
6 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVIDER_H_
8 #include "base/files/file.h"
9 #include "base/macros.h"
10 #include "components/translate/content/renderer/renderer_cld_data_provider.h"
11 #include "ipc/ipc_platform_file.h"
15 class DataFileRendererCldDataProvider : public RendererCldDataProvider {
17 explicit DataFileRendererCldDataProvider(content::RenderViewObserver*);
18 virtual ~DataFileRendererCldDataProvider();
19 // RendererCldDataProvider implementations:
20 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE;
21 virtual void SendCldDataRequest() OVERRIDE;
22 virtual void SetCldAvailableCallback(base::Callback<void(void)>) OVERRIDE;
23 virtual bool IsCldDataAvailable() OVERRIDE;
26 void OnCldDataAvailable(const IPC::PlatformFileForTransit ipc_file_handle,
27 const uint64 data_offset,
28 const uint64 data_length);
29 void LoadCldData(base::File file,
30 const uint64 data_offset,
31 const uint64 data_length);
32 content::RenderViewObserver* render_view_observer_;
33 base::Callback<void(void)> cld_available_callback_;
35 DISALLOW_COPY_AND_ASSIGN(DataFileRendererCldDataProvider);
38 } // namespace translate
40 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVIDER_H_