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_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ | 6 #ifndef CHROME_BROWSER_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ |
7 #define CHROME_BROWSER_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ | 7 #define CHROME_BROWSER_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "ui/base/dragdrop/download_file_interface.h" | 27 #include "ui/base/dragdrop/download_file_interface.h" |
28 | 28 |
29 template <typename T> struct DefaultSingletonTraits; | 29 template <typename T> struct DefaultSingletonTraits; |
30 | 30 |
31 static const std::string kPropertyPath = "path"; | 31 static const std::string kPropertyPath = "path"; |
32 static const std::string kPropertyTitle = "title"; | 32 static const std::string kPropertyTitle = "title"; |
33 static const std::string kPropertyDirectory = "isDirectory"; | 33 static const std::string kPropertyDirectory = "isDirectory"; |
34 static const std::string kImageBaseURL = | 34 static const std::string kImageBaseURL = |
35 "http://chrome-master.mtv.corp.google.com/chromeos/dev-channel/"; | 35 "http://chrome-master.mtv.corp.google.com/chromeos/dev-channel/"; |
36 static const std::string kImageFetcherName = "LATEST-x86-generic"; | 36 static const std::string kImageFetcherName = "LATEST-x86-generic"; |
37 static const std::string kImageFileName = "chromeos_image.bin.gz"; | 37 static const std::string kImageDownloadURL = |
38 "https://dl.google.com/dl/chromeos/recovery/latest_mario_beta_channel"; | |
39 static const std::string kImageFileName = "chromeos_image.bin.zip"; | |
38 static const std::string kTempImageFolderName = "chromeos_image"; | 40 static const std::string kTempImageFolderName = "chromeos_image"; |
xiyuan
2011/01/25 17:28:30
Since you touch this file, could we get rid of the
achuithb
2011/01/25 22:21:45
Good point - moved them to .cc. It's convenient fo
| |
39 | 41 |
40 class ImageBurnResourceManager; | 42 class ImageBurnResourceManager; |
41 class TabContents; | 43 class TabContents; |
42 | 44 |
43 class ImageBurnUIHTMLSource : public ChromeURLDataManager::DataSource { | |
44 public: | |
45 ImageBurnUIHTMLSource(); | |
46 | |
47 // Called when the network layer has requested a resource underneath | |
48 // the path we registered. | |
49 virtual void StartDataRequest(const std::string& path, | |
50 bool is_off_the_record, | |
51 int request_id); | |
52 virtual std::string GetMimeType(const std::string&) const { | |
53 return "text/html"; | |
54 } | |
55 | |
56 private: | |
57 ~ImageBurnUIHTMLSource() {} | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(ImageBurnUIHTMLSource); | |
60 }; | |
61 | |
62 class ImageBurnHandler : public DOMMessageHandler, | 45 class ImageBurnHandler : public DOMMessageHandler, |
63 public chromeos::MountLibrary::Observer, | 46 public chromeos::MountLibrary::Observer, |
64 public chromeos::BurnLibrary::Observer, | 47 public chromeos::BurnLibrary::Observer, |
65 public DownloadManager::Observer, | 48 public DownloadManager::Observer, |
66 public DownloadItem::Observer, | 49 public DownloadItem::Observer, |
67 public base::SupportsWeakPtr<ImageBurnHandler> { | 50 public base::SupportsWeakPtr<ImageBurnHandler> { |
68 public: | 51 public: |
69 explicit ImageBurnHandler(TabContents* contents); | 52 explicit ImageBurnHandler(TabContents* contents); |
70 virtual ~ImageBurnHandler(); | 53 virtual ~ImageBurnHandler(); |
71 | 54 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 DownloadManager* download_manager_; | 113 DownloadManager* download_manager_; |
131 bool download_item_observer_added_; | 114 bool download_item_observer_added_; |
132 DownloadItem* active_download_item_; | 115 DownloadItem* active_download_item_; |
133 ImageBurnResourceManager* burn_resource_manager_; | 116 ImageBurnResourceManager* burn_resource_manager_; |
134 | 117 |
135 friend class ImageBurnTaskProxy; | 118 friend class ImageBurnTaskProxy; |
136 | 119 |
137 DISALLOW_COPY_AND_ASSIGN(ImageBurnHandler); | 120 DISALLOW_COPY_AND_ASSIGN(ImageBurnHandler); |
138 }; | 121 }; |
139 | 122 |
140 class ImageBurnTaskProxy | |
141 : public base::RefCountedThreadSafe<ImageBurnTaskProxy> { | |
142 public: | |
143 explicit ImageBurnTaskProxy(const base::WeakPtr<ImageBurnHandler>& handler); | |
144 | |
145 bool ReportDownloadInitialized(); | |
146 bool CheckDownloadFinished(); | |
147 void BurnImage(); | |
148 void FinalizeBurn(bool success); | |
149 | |
150 void CreateImageUrl(TabContents* tab_contents, ImageBurnHandler* downloader); | |
151 | |
152 private: | |
153 base::WeakPtr<ImageBurnHandler> handler_; | |
154 ImageBurnResourceManager* resource_manager_; | |
155 | |
156 friend class base::RefCountedThreadSafe<ImageBurnTaskProxy>; | |
157 | |
158 DISALLOW_COPY_AND_ASSIGN(ImageBurnTaskProxy); | |
159 }; | |
160 | |
161 class ImageBurnResourceManager : public DownloadManager::Observer, | 123 class ImageBurnResourceManager : public DownloadManager::Observer, |
162 public DownloadItem::Observer { | 124 public DownloadItem::Observer { |
163 public: | 125 public: |
164 // Returns the singleton instance. | 126 // Returns the singleton instance. |
165 static ImageBurnResourceManager* GetInstance(); | 127 static ImageBurnResourceManager* GetInstance(); |
166 | 128 |
167 // DownloadItem::Observer interface | 129 // DownloadItem::Observer interface |
168 virtual void OnDownloadUpdated(DownloadItem* download); | 130 virtual void OnDownloadUpdated(DownloadItem* download); |
169 virtual void OnDownloadFileCompleted(DownloadItem* download); | 131 virtual void OnDownloadFileCompleted(DownloadItem* download); |
170 virtual void OnDownloadOpened(DownloadItem* download); | 132 virtual void OnDownloadOpened(DownloadItem* download); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 }; | 179 }; |
218 | 180 |
219 class ImageBurnUI : public DOMUI { | 181 class ImageBurnUI : public DOMUI { |
220 public: | 182 public: |
221 explicit ImageBurnUI(TabContents* contents); | 183 explicit ImageBurnUI(TabContents* contents); |
222 | 184 |
223 private: | 185 private: |
224 DISALLOW_COPY_AND_ASSIGN(ImageBurnUI); | 186 DISALLOW_COPY_AND_ASSIGN(ImageBurnUI); |
225 }; | 187 }; |
226 #endif // CHROME_BROWSER_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ | 188 #endif // CHROME_BROWSER_CHROMEOS_DOM_UI_IMAGEBURNER_UI_H_ |
OLD | NEW |