| OLD | NEW |
| 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/ui/webui/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // returned once fetching failed or exceeded |kOnlineTermsTimeoutSec|. | 150 // returned once fetching failed or exceeded |kOnlineTermsTimeoutSec|. |
| 151 class ChromeOSOnlineTermsHandler : public net::URLFetcherDelegate { | 151 class ChromeOSOnlineTermsHandler : public net::URLFetcherDelegate { |
| 152 public: | 152 public: |
| 153 typedef base::Callback<void (ChromeOSOnlineTermsHandler*)> FetchCallback; | 153 typedef base::Callback<void (ChromeOSOnlineTermsHandler*)> FetchCallback; |
| 154 | 154 |
| 155 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback, | 155 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback, |
| 156 const std::string& locale) | 156 const std::string& locale) |
| 157 : fetch_callback_(callback) { | 157 : fetch_callback_(callback) { |
| 158 std::string eula_URL = base::StringPrintf(chrome::kOnlineEulaURLPath, | 158 std::string eula_URL = base::StringPrintf(chrome::kOnlineEulaURLPath, |
| 159 locale.c_str()); | 159 locale.c_str()); |
| 160 eula_fetcher_.reset(net::URLFetcher::Create(GURL(eula_URL), | 160 eula_fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */, |
| 161 GURL(eula_URL), |
| 161 net::URLFetcher::GET, | 162 net::URLFetcher::GET, |
| 162 this)); | 163 this)); |
| 163 eula_fetcher_->SetRequestContext( | 164 eula_fetcher_->SetRequestContext( |
| 164 g_browser_process->system_request_context()); | 165 g_browser_process->system_request_context()); |
| 165 eula_fetcher_->AddExtraRequestHeader("Accept: text/html"); | 166 eula_fetcher_->AddExtraRequestHeader("Accept: text/html"); |
| 166 eula_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 167 eula_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 167 net::LOAD_DO_NOT_SAVE_COOKIES | | 168 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 168 net::LOAD_DISABLE_CACHE); | 169 net::LOAD_DISABLE_CACHE); |
| 169 eula_fetcher_->Start(); | 170 eula_fetcher_->Start(); |
| 170 // Abort the download attempt if it takes longer than one minute. | 171 // Abort the download attempt if it takes longer than one minute. |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 Profile* profile = Profile::FromWebUI(web_ui); | 1189 Profile* profile = Profile::FromWebUI(web_ui); |
| 1189 | 1190 |
| 1190 #if defined(ENABLE_THEMES) | 1191 #if defined(ENABLE_THEMES) |
| 1191 // Set up the chrome://theme/ source. | 1192 // Set up the chrome://theme/ source. |
| 1192 ThemeSource* theme = new ThemeSource(profile); | 1193 ThemeSource* theme = new ThemeSource(profile); |
| 1193 content::URLDataSource::Add(profile, theme); | 1194 content::URLDataSource::Add(profile, theme); |
| 1194 #endif | 1195 #endif |
| 1195 | 1196 |
| 1196 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 1197 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
| 1197 } | 1198 } |
| OLD | NEW |