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

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

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos_unittests Created 7 years, 7 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_manager.h" 5 #include "chrome/browser/chromeos/imageburner/burn_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 cancelled_(false), 219 cancelled_(false),
220 burning_(false), 220 burning_(false),
221 block_burn_signals_(false), 221 block_burn_signals_(false),
222 image_dir_(downloads_directory.Append(kTempImageFolderName)), 222 image_dir_(downloads_directory.Append(kTempImageFolderName)),
223 config_file_url_(kConfigFileUrl), 223 config_file_url_(kConfigFileUrl),
224 config_file_fetched_(false), 224 config_file_fetched_(false),
225 state_machine_(new StateMachine()), 225 state_machine_(new StateMachine()),
226 url_request_context_getter_(context_getter), 226 url_request_context_getter_(context_getter),
227 bytes_image_download_progress_last_reported_(0), 227 bytes_image_download_progress_last_reported_(0),
228 weak_ptr_factory_(this) { 228 weak_ptr_factory_(this) {
229 NetworkStateHandler::Get()->AddObserver(this); 229 NetworkHandler::Get()->network_state_handler()->AddObserver(this);
230 base::WeakPtr<BurnManager> weak_ptr(weak_ptr_factory_.GetWeakPtr()); 230 base::WeakPtr<BurnManager> weak_ptr(weak_ptr_factory_.GetWeakPtr());
231 device_handler_.SetCallbacks( 231 device_handler_.SetCallbacks(
232 base::Bind(&BurnManager::NotifyDeviceAdded, weak_ptr), 232 base::Bind(&BurnManager::NotifyDeviceAdded, weak_ptr),
233 base::Bind(&BurnManager::NotifyDeviceRemoved, weak_ptr)); 233 base::Bind(&BurnManager::NotifyDeviceRemoved, weak_ptr));
234 DBusThreadManager::Get()->GetImageBurnerClient()->SetEventHandlers( 234 DBusThreadManager::Get()->GetImageBurnerClient()->SetEventHandlers(
235 base::Bind(&BurnManager::OnBurnFinished, 235 base::Bind(&BurnManager::OnBurnFinished,
236 weak_ptr_factory_.GetWeakPtr()), 236 weak_ptr_factory_.GetWeakPtr()),
237 base::Bind(&BurnManager::OnBurnProgressUpdate, 237 base::Bind(&BurnManager::OnBurnProgressUpdate,
238 weak_ptr_factory_.GetWeakPtr())); 238 weak_ptr_factory_.GetWeakPtr()));
239 } 239 }
240 240
241 BurnManager::~BurnManager() { 241 BurnManager::~BurnManager() {
242 if (image_dir_created_) { 242 if (image_dir_created_) {
243 file_util::Delete(image_dir_, true); 243 file_util::Delete(image_dir_, true);
244 } 244 }
245 NetworkStateHandler::Get()->RemoveObserver(this); 245 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this);
246 DBusThreadManager::Get()->GetImageBurnerClient()->ResetEventHandlers(); 246 DBusThreadManager::Get()->GetImageBurnerClient()->ResetEventHandlers();
247 } 247 }
248 248
249 // static 249 // static
250 void BurnManager::Initialize( 250 void BurnManager::Initialize(
251 const base::FilePath& downloads_directory, 251 const base::FilePath& downloads_directory,
252 scoped_refptr<net::URLRequestContextGetter> context_getter) { 252 scoped_refptr<net::URLRequestContextGetter> context_getter) {
253 if (g_burn_manager) { 253 if (g_burn_manager) {
254 LOG(WARNING) << "BurnManager was already initialized"; 254 LOG(WARNING) << "BurnManager was already initialized";
255 return; 255 return;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // Note: in theory, this is not a part of notification, but cancelling 645 // Note: in theory, this is not a part of notification, but cancelling
646 // the running burning task. However, there is no good place to be in the 646 // the running burning task. However, there is no good place to be in the
647 // current code. 647 // current code.
648 // TODO(hidehiko): Clean this up after refactoring. 648 // TODO(hidehiko): Clean this up after refactoring.
649 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); 649 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR);
650 } 650 }
651 } 651 }
652 652
653 } // namespace imageburner 653 } // namespace imageburner
654 } // namespace chromeos 654 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/imageburner/burn_controller.cc ('k') | chrome/browser/chromeos/net/connectivity_state_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698