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

Side by Side Diff: chrome/browser/chromeos/imageburner/burn_controller.cc

Issue 10829160: Created a helper function "FindDiskBySourcePath" in DiskMountManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 4 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 | Annotate | Revision Log
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 #include "chrome/browser/chromeos/imageburner/burn_controller.h" 5 #include "chrome/browser/chromeos/imageburner/burn_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/chromeos/cros/burn_library.h" 10 #include "chrome/browser/chromeos/cros/burn_library.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 CrosLibrary::Get()->GetBurnLibrary()->CancelBurnImage(); 327 CrosLibrary::Get()->GetBurnLibrary()->CancelBurnImage();
328 CrosLibrary::Get()->GetBurnLibrary()->RemoveObserver(this); 328 CrosLibrary::Get()->GetBurnLibrary()->RemoveObserver(this);
329 observing_burn_lib_ = false; 329 observing_burn_lib_ = false;
330 } 330 }
331 burn_manager_->ResetTargetPaths(); 331 burn_manager_->ResetTargetPaths();
332 } 332 }
333 333
334 int64 GetDeviceSize(const std::string& device_path) { 334 int64 GetDeviceSize(const std::string& device_path) {
335 disks::DiskMountManager* disk_mount_manager = 335 disks::DiskMountManager* disk_mount_manager =
336 disks::DiskMountManager::GetInstance(); 336 disks::DiskMountManager::GetInstance();
337 const disks::DiskMountManager::DiskMap& disks = disk_mount_manager->disks(); 337 const disks::DiskMountManager::Disk* disk =
338 return disks.find(device_path)->second->total_size_in_bytes(); 338 disk_mount_manager->FindDiskBySourcePath(device_path);
339 return disk ? disk->total_size_in_bytes() : 0;
339 } 340 }
340 341
341 bool CheckNetwork() { 342 bool CheckNetwork() {
342 return CrosLibrary::Get()->GetNetworkLibrary()->Connected(); 343 return CrosLibrary::Get()->GetNetworkLibrary()->Connected();
343 } 344 }
344 345
345 FilePath zip_image_file_path_; 346 FilePath zip_image_file_path_;
346 std::string image_file_name_; 347 std::string image_file_name_;
347 BurnManager* burn_manager_; 348 BurnManager* burn_manager_;
348 StateMachine* state_machine_; 349 StateMachine* state_machine_;
349 bool observing_burn_lib_; 350 bool observing_burn_lib_;
350 bool working_; 351 bool working_;
351 BurnController::Delegate* delegate_; 352 BurnController::Delegate* delegate_;
352 353
353 DISALLOW_COPY_AND_ASSIGN(BurnControllerImpl); 354 DISALLOW_COPY_AND_ASSIGN(BurnControllerImpl);
354 }; 355 };
355 356
356 } // namespace 357 } // namespace
357 358
358 // static 359 // static
359 BurnController* BurnController::CreateBurnController( 360 BurnController* BurnController::CreateBurnController(
360 content::WebContents* web_contents, 361 content::WebContents* web_contents,
361 Delegate* delegate) { 362 Delegate* delegate) {
362 return new BurnControllerImpl(delegate); 363 return new BurnControllerImpl(delegate);
363 } 364 }
364 365
365 } // namespace imageburner 366 } // namespace imageburner
366 } // namespace chromeos 367 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698