| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/apply_services_customization.h" | 5 #include "chrome/browser/chromeos/login/apply_services_customization.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void ApplyServicesCustomization::StartFileFetch() { | 97 void ApplyServicesCustomization::StartFileFetch() { |
| 98 url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this)); | 98 url_fetcher_.reset(new URLFetcher(url_, URLFetcher::GET, this)); |
| 99 url_fetcher_->set_request_context( | 99 url_fetcher_->set_request_context( |
| 100 ProfileManager::GetDefaultProfile()->GetRequestContext()); | 100 ProfileManager::GetDefaultProfile()->GetRequestContext()); |
| 101 url_fetcher_->Start(); | 101 url_fetcher_->Start(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ApplyServicesCustomization::OnURLFetchComplete( | 104 void ApplyServicesCustomization::OnURLFetchComplete( |
| 105 const URLFetcher* source, | 105 const URLFetcher* source, |
| 106 const GURL& url, | 106 const GURL& url, |
| 107 const URLRequestStatus& status, | 107 const net::URLRequestStatus& status, |
| 108 int response_code, | 108 int response_code, |
| 109 const ResponseCookies& cookies, | 109 const ResponseCookies& cookies, |
| 110 const std::string& data) { | 110 const std::string& data) { |
| 111 if (response_code == 200) { | 111 if (response_code == 200) { |
| 112 Apply(data); | 112 Apply(data); |
| 113 } else { | 113 } else { |
| 114 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 114 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
| 115 if (!network->Connected() && num_retries_ < kMaxFetchRetries) { | 115 if (!network->Connected() && num_retries_ < kMaxFetchRetries) { |
| 116 num_retries_++; | 116 num_retries_++; |
| 117 retry_timer_.Start(base::TimeDelta::FromSeconds(kRetriesDelayInSec), | 117 retry_timer_.Start(base::TimeDelta::FromSeconds(kRetriesDelayInSec), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 140 customization.initial_start_page_url()); | 140 customization.initial_start_page_url()); |
| 141 VLOG(1) << "initial_start_page_url: " | 141 VLOG(1) << "initial_start_page_url: " |
| 142 << customization.initial_start_page_url(); | 142 << customization.initial_start_page_url(); |
| 143 } | 143 } |
| 144 // TODO(dpolukhin): apply customized apps, exts and support page. | 144 // TODO(dpolukhin): apply customized apps, exts and support page. |
| 145 | 145 |
| 146 SetApplied(true); | 146 SetApplied(true); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } | 149 } |
| OLD | NEW |