| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "content/public/common/url_fetcher_delegate.h" | |
| 19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "net/url_request/url_fetcher_delegate.h" |
| 20 |
| 21 namespace net { |
| 22 class URLFetcher; |
| 23 } // namespace net |
| 20 | 24 |
| 21 namespace chromeos { | 25 namespace chromeos { |
| 22 namespace imageburner { | 26 namespace imageburner { |
| 23 | 27 |
| 24 // Config file properties. | 28 // Config file properties. |
| 25 extern const char kName[]; | 29 extern const char kName[]; |
| 26 extern const char kHwid[]; | 30 extern const char kHwid[]; |
| 27 extern const char kFileName[]; | 31 extern const char kFileName[]; |
| 28 extern const char kUrl[]; | 32 extern const char kUrl[]; |
| 29 | 33 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 bool download_started_; | 151 bool download_started_; |
| 148 bool download_finished_; | 152 bool download_finished_; |
| 149 | 153 |
| 150 State state_; | 154 State state_; |
| 151 | 155 |
| 152 ObserverList<Observer> observers_; | 156 ObserverList<Observer> observers_; |
| 153 | 157 |
| 154 DISALLOW_COPY_AND_ASSIGN(StateMachine); | 158 DISALLOW_COPY_AND_ASSIGN(StateMachine); |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 class BurnManager : content::URLFetcherDelegate { | 161 class BurnManager : net::URLFetcherDelegate { |
| 158 public: | 162 public: |
| 159 | 163 |
| 160 class Delegate : public base::SupportsWeakPtr<Delegate> { | 164 class Delegate : public base::SupportsWeakPtr<Delegate> { |
| 161 public: | 165 public: |
| 162 virtual void OnImageDirCreated(bool success) = 0; | 166 virtual void OnImageDirCreated(bool success) = 0; |
| 163 virtual void OnConfigFileFetched(bool success, | 167 virtual void OnConfigFileFetched(bool success, |
| 164 const std::string& image_file_name, | 168 const std::string& image_file_name, |
| 165 const GURL& image_download_url) = 0; | 169 const GURL& image_download_url) = 0; |
| 166 }; | 170 }; |
| 167 | 171 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 FilePath target_file_path_; | 249 FilePath target_file_path_; |
| 246 | 250 |
| 247 GURL config_file_url_; | 251 GURL config_file_url_; |
| 248 bool config_file_fetched_; | 252 bool config_file_fetched_; |
| 249 std::string image_file_name_; | 253 std::string image_file_name_; |
| 250 GURL image_download_url_; | 254 GURL image_download_url_; |
| 251 std::vector<base::WeakPtr<Delegate> > downloaders_; | 255 std::vector<base::WeakPtr<Delegate> > downloaders_; |
| 252 | 256 |
| 253 scoped_ptr<StateMachine> state_machine_; | 257 scoped_ptr<StateMachine> state_machine_; |
| 254 | 258 |
| 255 scoped_ptr<content::URLFetcher> config_fetcher_; | 259 scoped_ptr<net::URLFetcher> config_fetcher_; |
| 256 scoped_ptr<content::URLFetcher> image_fetcher_; | 260 scoped_ptr<net::URLFetcher> image_fetcher_; |
| 257 | 261 |
| 258 base::TimeTicks tick_image_download_start_; | 262 base::TimeTicks tick_image_download_start_; |
| 259 int64 bytes_image_download_progress_last_reported_; | 263 int64 bytes_image_download_progress_last_reported_; |
| 260 | 264 |
| 261 ObserverList<Observer> observers_; | 265 ObserverList<Observer> observers_; |
| 262 | 266 |
| 263 DISALLOW_COPY_AND_ASSIGN(BurnManager); | 267 DISALLOW_COPY_AND_ASSIGN(BurnManager); |
| 264 }; | 268 }; |
| 265 | 269 |
| 266 } // namespace imageburner | 270 } // namespace imageburner |
| 267 | 271 |
| 268 } // namespace chromeos | 272 } // namespace chromeos |
| 269 | 273 |
| 270 #endif // CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ | 274 #endif // CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ |
| OLD | NEW |