Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 COMPONENTS_TRANSLATE_CONTENT_BROWSER_DATA_FILE_BROWSER_CLD_DATA_PROVIDER _H_ | |
| 6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_DATA_FILE_BROWSER_CLD_DATA_PROVIDER _H_ | |
| 7 | |
| 8 #include "base/files/file.h" | |
| 9 #include "base/files/file_path.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "components/translate/content/browser/browser_cld_data_provider.h" | |
| 14 | |
| 15 namespace translate { | |
| 16 | |
| 17 class DataFileBrowserCldDataProvider : public BrowserCldDataProvider { | |
| 18 public: | |
| 19 explicit DataFileBrowserCldDataProvider(content::RenderViewHost*); | |
| 20 virtual ~DataFileBrowserCldDataProvider(); | |
| 21 // BrowserCldDataProvider implementations: | |
| 22 virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE; | |
| 23 virtual void OnCldDataRequest() OVERRIDE; | |
| 24 virtual void SendCldDataResponse() OVERRIDE; | |
| 25 | |
| 26 // Sets the data file that this data provider will use to fulfill requests. | |
| 27 // This method does nothing if the specified path is equal to the path that | |
| 28 // is already configured. Otherwise, the specified path is cached and | |
| 29 // subsequent requests for data will attempt to load CLD data from the file | |
| 30 // at the specified path. | |
| 31 // This method is threadsafe. | |
| 32 static void SetCldDataFilePath(const base::FilePath& filePath); | |
| 33 | |
| 34 // Returns the path most recently set by SetDataFilePath. The initial value | |
| 35 // prior to any such call is the empty path. | |
| 36 // This method is threadsafe. | |
| 37 static base::FilePath GetCldDataFilePath(); | |
| 38 | |
| 39 private: | |
| 40 void SendCldDataResponseInternal(const base::File*, | |
| 41 const uint64, | |
| 42 const uint64); | |
| 43 static void OnCldDataRequestInternal(); | |
| 44 | |
| 45 content::RenderViewHost* render_view_host; | |
| 46 scoped_ptr<base::WeakPtrFactory <DataFileBrowserCldDataProvider> > | |
| 47 weak_pointer_factory_; | |
|
Takashi Toyoshima
2014/06/23 08:50:01
four spaces indent (two more spaces)
Andrew Hayden (chromium.org)
2014/06/23 13:20:36
Done.
| |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(DataFileBrowserCldDataProvider); | |
| 50 }; | |
| 51 | |
| 52 } // namespace translate | |
| 53 | |
| 54 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_DATA_FILE_BROWSER_CLD_DATA_PROVI DER_H_ | |
| OLD | NEW |