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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // returned once fetching failed or exceeded |kOnlineTermsTimeoutSec|. | 143 // returned once fetching failed or exceeded |kOnlineTermsTimeoutSec|. |
144 class ChromeOSOnlineTermsHandler : public net::URLFetcherDelegate { | 144 class ChromeOSOnlineTermsHandler : public net::URLFetcherDelegate { |
145 public: | 145 public: |
146 typedef base::Callback<void (ChromeOSOnlineTermsHandler*)> FetchCallback; | 146 typedef base::Callback<void (ChromeOSOnlineTermsHandler*)> FetchCallback; |
147 | 147 |
148 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback, | 148 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback, |
149 const std::string& locale) | 149 const std::string& locale) |
150 : fetch_callback_(callback) { | 150 : fetch_callback_(callback) { |
151 std::string eula_URL = base::StringPrintf(chrome::kOnlineEulaURLPath, | 151 std::string eula_URL = base::StringPrintf(chrome::kOnlineEulaURLPath, |
152 locale.c_str()); | 152 locale.c_str()); |
153 eula_fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */, | 153 eula_fetcher_ = |
154 GURL(eula_URL), | 154 net::URLFetcher::Create(0 /* ID used for testing */, GURL(eula_URL), |
155 net::URLFetcher::GET, | 155 net::URLFetcher::GET, this); |
156 this)); | |
157 eula_fetcher_->SetRequestContext( | 156 eula_fetcher_->SetRequestContext( |
158 g_browser_process->system_request_context()); | 157 g_browser_process->system_request_context()); |
159 eula_fetcher_->AddExtraRequestHeader("Accept: text/html"); | 158 eula_fetcher_->AddExtraRequestHeader("Accept: text/html"); |
160 eula_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 159 eula_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
161 net::LOAD_DO_NOT_SAVE_COOKIES | | 160 net::LOAD_DO_NOT_SAVE_COOKIES | |
162 net::LOAD_DISABLE_CACHE); | 161 net::LOAD_DISABLE_CACHE); |
163 eula_fetcher_->Start(); | 162 eula_fetcher_->Start(); |
164 // Abort the download attempt if it takes longer than one minute. | 163 // Abort the download attempt if it takes longer than one minute. |
165 download_timer_.Start(FROM_HERE, | 164 download_timer_.Start(FROM_HERE, |
166 base::TimeDelta::FromSeconds(kOnlineTermsTimeoutSec), | 165 base::TimeDelta::FromSeconds(kOnlineTermsTimeoutSec), |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 Profile* profile = Profile::FromWebUI(web_ui); | 988 Profile* profile = Profile::FromWebUI(web_ui); |
990 | 989 |
991 #if defined(ENABLE_THEMES) | 990 #if defined(ENABLE_THEMES) |
992 // Set up the chrome://theme/ source. | 991 // Set up the chrome://theme/ source. |
993 ThemeSource* theme = new ThemeSource(profile); | 992 ThemeSource* theme = new ThemeSource(profile); |
994 content::URLDataSource::Add(profile, theme); | 993 content::URLDataSource::Add(profile, theme); |
995 #endif | 994 #endif |
996 | 995 |
997 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 996 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
998 } | 997 } |
OLD | NEW |