| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 5 |
| 6 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ | 6 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ |
| 7 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ | 7 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual void OnBurnDownloadStarted(bool success) = 0; | 42 virtual void OnBurnDownloadStarted(bool success) = 0; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 public: | 45 public: |
| 46 Downloader(); | 46 Downloader(); |
| 47 ~Downloader(); | 47 ~Downloader(); |
| 48 | 48 |
| 49 // Downloads a file from the Internet. | 49 // Downloads a file from the Internet. |
| 50 // Should be called from UI thread. | 50 // Should be called from UI thread. |
| 51 void DownloadFile(const GURL& url, const FilePath& target_file, | 51 void DownloadFile(const GURL& url, const FilePath& target_file, |
| 52 TabContents* tab_contents); | 52 content::WebContents* web_contents); |
| 53 | 53 |
| 54 // Creates file stream for a download. | 54 // Creates file stream for a download. |
| 55 // Must be called from FILE thread. | 55 // Must be called from FILE thread. |
| 56 void CreateFileStreamOnFileThread(const GURL& url, const FilePath& file_path, | 56 void CreateFileStreamOnFileThread(const GURL& url, const FilePath& file_path, |
| 57 TabContents* tab_contents); | 57 content::WebContents* web_contents); |
| 58 | 58 |
| 59 // Gets called after file stream is created and starts download. | 59 // Gets called after file stream is created and starts download. |
| 60 void OnFileStreamCreatedOnUIThread(const GURL& url, | 60 void OnFileStreamCreatedOnUIThread(const GURL& url, |
| 61 const FilePath& file_path, TabContents* tab_contents, | 61 const FilePath& file_path, content::WebContents* web_contents, |
| 62 net::FileStream* created_file_stream); | 62 net::FileStream* created_file_stream); |
| 63 | 63 |
| 64 // Adds an item to list of listeners that wait for confirmation that download | 64 // Adds an item to list of listeners that wait for confirmation that download |
| 65 // has started. | 65 // has started. |
| 66 void AddListener(Listener* listener, const GURL& url); | 66 void AddListener(Listener* listener, const GURL& url); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // Let listeners know if download started successfully. | 69 // Let listeners know if download started successfully. |
| 70 void DownloadStarted(bool success, const GURL& url); | 70 void DownloadStarted(bool success, const GURL& url); |
| 71 | 71 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE {} | 228 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE {} |
| 229 | 229 |
| 230 // content::DownloadManager::Observer interface. | 230 // content::DownloadManager::Observer interface. |
| 231 virtual void ModelChanged() OVERRIDE; | 231 virtual void ModelChanged() OVERRIDE; |
| 232 | 232 |
| 233 // Downloader::Listener interface. | 233 // Downloader::Listener interface. |
| 234 virtual void OnBurnDownloadStarted(bool success) OVERRIDE; | 234 virtual void OnBurnDownloadStarted(bool success) OVERRIDE; |
| 235 | 235 |
| 236 // Creates URL image should be fetched from. | 236 // Creates URL image should be fetched from. |
| 237 // Must be called from UI thread. | 237 // Must be called from UI thread. |
| 238 void FetchConfigFile(TabContents* tab_content, | 238 void FetchConfigFile(content::WebContents* web_content, |
| 239 Delegate* delegate); | 239 Delegate* delegate); |
| 240 | 240 |
| 241 // Creates directory image will be downloaded to. | 241 // Creates directory image will be downloaded to. |
| 242 // Must be called from FILE thread. | 242 // Must be called from FILE thread. |
| 243 void CreateImageDir(Delegate* delegate); | 243 void CreateImageDir(Delegate* delegate); |
| 244 | 244 |
| 245 // Returns directory image should be dopwnloaded to. | 245 // Returns directory image should be dopwnloaded to. |
| 246 // The directory has to be previously created. | 246 // The directory has to be previously created. |
| 247 const FilePath& GetImageDir(); | 247 const FilePath& GetImageDir(); |
| 248 | 248 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 scoped_ptr<StateMachine> state_machine_; | 304 scoped_ptr<StateMachine> state_machine_; |
| 305 | 305 |
| 306 scoped_ptr<Downloader> downloader_; | 306 scoped_ptr<Downloader> downloader_; |
| 307 | 307 |
| 308 DISALLOW_COPY_AND_ASSIGN(BurnManager); | 308 DISALLOW_COPY_AND_ASSIGN(BurnManager); |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 } // namespace imageburner. | 311 } // namespace imageburner. |
| 312 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ | 312 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UTILS_H_ |
| 313 | 313 |
| OLD | NEW |