Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/chromeos/imageburner/burn_manager.h

Issue 12729002: Add a unified observer to replace NetworkManagerObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 14 #include "base/files/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 "chrome/browser/chromeos/cros/burn_library.h" 18 #include "chrome/browser/chromeos/cros/burn_library.h"
19 #include "chrome/browser/chromeos/cros/network_library.h"
20 #include "chrome/browser/chromeos/imageburner/burn_device_handler.h" 19 #include "chrome/browser/chromeos/imageburner/burn_device_handler.h"
20 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h"
21 #include "chromeos/disks/disk_mount_manager.h" 21 #include "chromeos/disks/disk_mount_manager.h"
22 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
23 #include "net/url_request/url_fetcher_delegate.h" 23 #include "net/url_request/url_fetcher_delegate.h"
24 24
25 namespace net { 25 namespace net {
26 class URLFetcher; 26 class URLFetcher;
27 } // namespace net 27 } // namespace net
28 28
29 namespace chromeos { 29 namespace chromeos {
30 namespace imageburner { 30 namespace imageburner {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // 4-1) Unzip the fetched image file. 173 // 4-1) Unzip the fetched image file.
174 // 4-2) Unmount the device from file system. 174 // 4-2) Unmount the device from file system.
175 // 4-3) Copy the unzipped file to the device directly. 175 // 4-3) Copy the unzipped file to the device directly.
176 // Currently, this only provides some methods to start/cancel background tasks, 176 // Currently, this only provides some methods to start/cancel background tasks,
177 // and some accessors to obtain the current status. Other functions are 177 // and some accessors to obtain the current status. Other functions are
178 // distributed among BurnController and BurnLibrary. 178 // distributed among BurnController and BurnLibrary.
179 // TODO(hidehiko): Simplify the relationship among this class, BurnLibrary, 179 // TODO(hidehiko): Simplify the relationship among this class, BurnLibrary,
180 // BurnController and helper classes defined above. 180 // BurnController and helper classes defined above.
181 class BurnManager : public net::URLFetcherDelegate, 181 class BurnManager : public net::URLFetcherDelegate,
182 public BurnLibrary::Observer, 182 public BurnLibrary::Observer,
183 public NetworkLibrary::NetworkManagerObserver { 183 public ConnectivityStateHelperObserver {
184 public: 184 public:
185 185
186 // Interface for classes that need to observe events for the burning image 186 // Interface for classes that need to observe events for the burning image
187 // tasks. 187 // tasks.
188 class Observer { 188 class Observer {
189 public: 189 public:
190 // Triggered when a burnable device is added. 190 // Triggered when a burnable device is added.
191 virtual void OnDeviceAdded(const disks::DiskMountManager::Disk& disk) = 0; 191 virtual void OnDeviceAdded(const disks::DiskMountManager::Disk& disk) = 0;
192 192
193 // Triggered when a burnable device is removed. 193 // Triggered when a burnable device is removed.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 // Cancel fetching image. 287 // Cancel fetching image.
288 void CancelImageFetch(); 288 void CancelImageFetch();
289 289
290 // URLFetcherDelegate overrides: 290 // URLFetcherDelegate overrides:
291 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 291 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
292 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, 292 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source,
293 int64 current, 293 int64 current,
294 int64 total) OVERRIDE; 294 int64 total) OVERRIDE;
295 295
296 // BurnLibrary::Observer orverrides. 296 // BurnLibrary::Observer overrides.
297 virtual void BurnProgressUpdated(BurnLibrary* object, 297 virtual void BurnProgressUpdated(BurnLibrary* object,
298 BurnEvent event, 298 BurnEvent event,
299 const ImageBurnStatus& status) OVERRIDE; 299 const ImageBurnStatus& status) OVERRIDE;
300 300
301 // NetworkLibrary::NetworkManagerObserver interface. 301 // ConnectivityStateHelperObserver override.
302 virtual void OnNetworkManagerChanged(NetworkLibrary* obj) OVERRIDE; 302 virtual void NetworkManagerChanged() OVERRIDE;
303 303
304 // Creates directory image will be downloaded to. 304 // Creates directory image will be downloaded to.
305 // Must be called from FILE thread. 305 // Must be called from FILE thread.
306 void CreateImageDir(); 306 void CreateImageDir();
307 307
308 // Returns directory image should be dopwnloaded to. 308 // Returns directory image should be dopwnloaded to.
309 // The directory has to be previously created. 309 // The directory has to be previously created.
310 const base::FilePath& GetImageDir(); 310 const base::FilePath& GetImageDir();
311 311
312 const base::FilePath& target_device_path() { return target_device_path_; } 312 const base::FilePath& target_device_path() { return target_device_path_; }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 base::WeakPtrFactory<BurnManager> weak_ptr_factory_; 363 base::WeakPtrFactory<BurnManager> weak_ptr_factory_;
364 364
365 DISALLOW_COPY_AND_ASSIGN(BurnManager); 365 DISALLOW_COPY_AND_ASSIGN(BurnManager);
366 }; 366 };
367 367
368 } // namespace imageburner 368 } // namespace imageburner
369 369
370 } // namespace chromeos 370 } // namespace chromeos
371 371
372 #endif // CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_ 372 #endif // CHROME_BROWSER_CHROMEOS_IMAGEBURNER_BURN_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_event_router.cc ('k') | chrome/browser/chromeos/imageburner/burn_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698