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

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

Issue 17010003: Cleanup of system settings constants (ab)use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/threading/worker_pool.h" 10 #include "base/threading/worker_pool.h"
11 #include "chrome/browser/chromeos/system/statistics_provider.h" 11 #include "chrome/browser/chromeos/system/statistics_provider.h"
12 #include "chromeos/dbus/dbus_thread_manager.h" 12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/image_burner_client.h" 13 #include "chromeos/dbus/image_burner_client.h"
14 #include "chromeos/network/network_state.h" 14 #include "chromeos/network/network_state.h"
15 #include "chromeos/network/network_state_handler.h" 15 #include "chromeos/network/network_state_handler.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "net/url_request/url_fetcher.h" 18 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_request_context_getter.h" 19 #include "net/url_request/url_request_context_getter.h"
20 #include "net/url_request/url_request_status.h" 20 #include "net/url_request/url_request_status.h"
21 #include "third_party/zlib/google/zip.h" 21 #include "third_party/zlib/google/zip.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 namespace chromeos { 25 namespace chromeos {
26 namespace imageburner { 26 namespace imageburner {
27 27
28 namespace { 28 namespace {
29 29
30 // Name for hwid in machine statistics.
31 const char kHwidStatistic[] = "hardware_class";
32
33 const char kConfigFileUrl[] = 30 const char kConfigFileUrl[] =
34 "https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf"; 31 "https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf";
35 const char kTempImageFolderName[] = "chromeos_image"; 32 const char kTempImageFolderName[] = "chromeos_image";
36 33
37 const char kImageZipFileName[] = "chromeos_image.bin.zip"; 34 const char kImageZipFileName[] = "chromeos_image.bin.zip";
38 35
39 const int64 kBytesImageDownloadProgressReportInterval = 10240; 36 const int64 kBytesImageDownloadProgressReportInterval = 10240;
40 37
41 BurnManager* g_burn_manager = NULL; 38 BurnManager* g_burn_manager = NULL;
42 39
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 549 }
553 } 550 }
554 551
555 void BurnManager::ConfigFileFetched(bool fetched, const std::string& content) { 552 void BurnManager::ConfigFileFetched(bool fetched, const std::string& content) {
556 if (config_file_fetched_) 553 if (config_file_fetched_)
557 return; 554 return;
558 555
559 // Get image file name and image download URL. 556 // Get image file name and image download URL.
560 std::string hwid; 557 std::string hwid;
561 if (fetched && system::StatisticsProvider::GetInstance()-> 558 if (fetched && system::StatisticsProvider::GetInstance()->
562 GetMachineStatistic(kHwidStatistic, &hwid)) { 559 GetMachineStatistic(system::kHardwareClass, &hwid)) {
563 ConfigFile config_file(content); 560 ConfigFile config_file(content);
564 image_file_name_ = config_file.GetProperty(kFileName, hwid); 561 image_file_name_ = config_file.GetProperty(kFileName, hwid);
565 image_download_url_ = GURL(config_file.GetProperty(kUrl, hwid)); 562 image_download_url_ = GURL(config_file.GetProperty(kUrl, hwid));
566 } 563 }
567 564
568 // Error check. 565 // Error check.
569 if (fetched && !image_file_name_.empty() && !image_download_url_.is_empty()) { 566 if (fetched && !image_file_name_.empty() && !image_download_url_.is_empty()) {
570 config_file_fetched_ = true; 567 config_file_fetched_ = true;
571 } else { 568 } else {
572 fetched = false; 569 fetched = false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 // Note: in theory, this is not a part of notification, but cancelling 646 // Note: in theory, this is not a part of notification, but cancelling
650 // the running burning task. However, there is no good place to be in the 647 // the running burning task. However, there is no good place to be in the
651 // current code. 648 // current code.
652 // TODO(hidehiko): Clean this up after refactoring. 649 // TODO(hidehiko): Clean this up after refactoring.
653 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); 650 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR);
654 } 651 }
655 } 652 }
656 653
657 } // namespace imageburner 654 } // namespace imageburner
658 } // namespace chromeos 655 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/info_private_api.cc ('k') | chrome/browser/chromeos/login/hwid_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698