| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/screens/terms_of_service_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/terms_of_service_screen.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // set, show an error message to the user. | 86 // set, show an error message to the user. |
| 87 std::string terms_of_service_url = | 87 std::string terms_of_service_url = |
| 88 prefs->GetString(prefs::kTermsOfServiceURL); | 88 prefs->GetString(prefs::kTermsOfServiceURL); |
| 89 if (terms_of_service_url.empty()) { | 89 if (terms_of_service_url.empty()) { |
| 90 if (actor_) | 90 if (actor_) |
| 91 actor_->OnLoadError(); | 91 actor_->OnLoadError(); |
| 92 return; | 92 return; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Start downloading the Terms of Service. | 95 // Start downloading the Terms of Service. |
| 96 terms_of_service_fetcher_.reset(net::URLFetcher::Create( | 96 terms_of_service_fetcher_ = net::URLFetcher::Create( |
| 97 GURL(terms_of_service_url), net::URLFetcher::GET, this)); | 97 GURL(terms_of_service_url), net::URLFetcher::GET, this); |
| 98 terms_of_service_fetcher_->SetRequestContext( | 98 terms_of_service_fetcher_->SetRequestContext( |
| 99 g_browser_process->system_request_context()); | 99 g_browser_process->system_request_context()); |
| 100 // Request a text/plain MIME type as only plain-text Terms of Service are | 100 // Request a text/plain MIME type as only plain-text Terms of Service are |
| 101 // accepted. | 101 // accepted. |
| 102 terms_of_service_fetcher_->AddExtraRequestHeader("Accept: text/plain"); | 102 terms_of_service_fetcher_->AddExtraRequestHeader("Accept: text/plain"); |
| 103 // Retry up to three times if network changes are detected during the | 103 // Retry up to three times if network changes are detected during the |
| 104 // download. | 104 // download. |
| 105 terms_of_service_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); | 105 terms_of_service_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3); |
| 106 terms_of_service_fetcher_->Start(); | 106 terms_of_service_fetcher_->Start(); |
| 107 | 107 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 !source->GetResponseAsString(&terms_of_service)) { | 142 !source->GetResponseAsString(&terms_of_service)) { |
| 143 actor_->OnLoadError(); | 143 actor_->OnLoadError(); |
| 144 } else { | 144 } else { |
| 145 // If the Terms of Service were downloaded successfully, show them to the | 145 // If the Terms of Service were downloaded successfully, show them to the |
| 146 // user. | 146 // user. |
| 147 actor_->OnLoadSuccess(terms_of_service); | 147 actor_->OnLoadSuccess(terms_of_service); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |