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

Side by Side Diff: chrome/browser/ui/webui/about_ui.cc

Issue 14120009: Add a command line parameter to disable online EULA. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed nit. Created 7 years, 8 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
« no previous file with comments | « no previous file | chromeos/chromeos_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
48 #include "content/public/common/content_client.h" 48 #include "content/public/common/content_client.h"
49 #include "content/public/common/process_type.h" 49 #include "content/public/common/process_type.h"
50 #include "google_apis/gaia/google_service_auth_error.h" 50 #include "google_apis/gaia/google_service_auth_error.h"
51 #include "googleurl/src/gurl.h" 51 #include "googleurl/src/gurl.h"
52 #include "grit/browser_resources.h" 52 #include "grit/browser_resources.h"
53 #include "grit/chromium_strings.h" 53 #include "grit/chromium_strings.h"
54 #include "grit/generated_resources.h" 54 #include "grit/generated_resources.h"
55 #include "grit/locale_settings.h" 55 #include "grit/locale_settings.h"
56 #include "net/base/escape.h" 56 #include "net/base/escape.h"
57 #include "net/base/load_flags.h"
57 #include "net/base/net_util.h" 58 #include "net/base/net_util.h"
58 #include "net/http/http_response_headers.h" 59 #include "net/http/http_response_headers.h"
59 #include "net/url_request/url_fetcher.h" 60 #include "net/url_request/url_fetcher.h"
60 #include "net/url_request/url_request_status.h" 61 #include "net/url_request/url_request_status.h"
61 #include "ui/base/l10n/l10n_util.h" 62 #include "ui/base/l10n/l10n_util.h"
62 #include "ui/base/resource/resource_bundle.h" 63 #include "ui/base/resource/resource_bundle.h"
63 #include "ui/webui/jstemplate_builder.h" 64 #include "ui/webui/jstemplate_builder.h"
64 #include "ui/webui/web_ui_util.h" 65 #include "ui/webui/web_ui_util.h"
65 66
66 #if defined(ENABLE_THEMES) 67 #if defined(ENABLE_THEMES)
67 #include "chrome/browser/ui/webui/theme_source.h" 68 #include "chrome/browser/ui/webui/theme_source.h"
68 #endif 69 #endif
69 70
70 #if defined(OS_LINUX) || defined(OS_OPENBSD) 71 #if defined(OS_LINUX) || defined(OS_OPENBSD)
71 #include "content/public/browser/zygote_host_linux.h" 72 #include "content/public/browser/zygote_host_linux.h"
72 #include "content/public/common/sandbox_linux.h" 73 #include "content/public/common/sandbox_linux.h"
73 #endif 74 #endif
74 75
75 #if defined(OS_WIN) 76 #if defined(OS_WIN)
76 #include "chrome/browser/enumerate_modules_model_win.h" 77 #include "chrome/browser/enumerate_modules_model_win.h"
77 #endif 78 #endif
78 79
79 #if defined(OS_CHROMEOS) 80 #if defined(OS_CHROMEOS)
80 #include "chrome/browser/chromeos/customization_document.h" 81 #include "chrome/browser/chromeos/customization_document.h"
81 #include "chrome/browser/chromeos/memory/oom_priority_manager.h" 82 #include "chrome/browser/chromeos/memory/oom_priority_manager.h"
82 #include "chrome/browser/ui/webui/chromeos/about_network.h" 83 #include "chrome/browser/ui/webui/chromeos/about_network.h"
84 #include "chromeos/chromeos_switches.h"
83 #endif 85 #endif
84 86
85 #if defined(USE_ASH) 87 #if defined(USE_ASH)
86 #include "ash/wm/frame_painter.h" 88 #include "ash/wm/frame_painter.h"
87 #include "base/strings/string_split.h" 89 #include "base/strings/string_split.h"
88 #endif 90 #endif
89 91
90 using base::Time; 92 using base::Time;
91 using base::TimeDelta; 93 using base::TimeDelta;
92 using content::BrowserThread; 94 using content::BrowserThread;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 152
151 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback) 153 explicit ChromeOSOnlineTermsHandler(const FetchCallback& callback)
152 : fetch_callback_(callback) { 154 : fetch_callback_(callback) {
153 eula_fetcher_.reset(net::URLFetcher::Create( 155 eula_fetcher_.reset(net::URLFetcher::Create(
154 GURL(l10n_util::GetStringUTF16(IDS_EULA_POLICY_URL)), 156 GURL(l10n_util::GetStringUTF16(IDS_EULA_POLICY_URL)),
155 net::URLFetcher::GET, 157 net::URLFetcher::GET,
156 this)); 158 this));
157 eula_fetcher_->SetRequestContext( 159 eula_fetcher_->SetRequestContext(
158 g_browser_process->system_request_context()); 160 g_browser_process->system_request_context());
159 eula_fetcher_->AddExtraRequestHeader("Accept: text/html"); 161 eula_fetcher_->AddExtraRequestHeader("Accept: text/html");
162 eula_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
163 net::LOAD_DO_NOT_SAVE_COOKIES |
164 net::LOAD_DISABLE_CACHE);
160 eula_fetcher_->Start(); 165 eula_fetcher_->Start();
161 // Abort the download attempt if it takes longer than one minute. 166 // Abort the download attempt if it takes longer than one minute.
162 download_timer_.Start(FROM_HERE, 167 download_timer_.Start(FROM_HERE,
163 base::TimeDelta::FromSeconds(kOnlineTermsTimeoutSec), 168 base::TimeDelta::FromSeconds(kOnlineTermsTimeoutSec),
164 this, 169 this,
165 &ChromeOSOnlineTermsHandler::OnDownloadTimeout); 170 &ChromeOSOnlineTermsHandler::OnDownloadTimeout);
166 } 171 }
167 172
168 void GetResponseResult(std::string* response_string) { 173 void GetResponseResult(std::string* response_string) {
169 std::string mime_type; 174 std::string mime_type;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 239
235 virtual ~ChromeOSTermsHandler() {} 240 virtual ~ChromeOSTermsHandler() {}
236 241
237 void StartOnUIThread() { 242 void StartOnUIThread() {
238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
239 if (path_ == chrome::kOemEulaURLPath) { 244 if (path_ == chrome::kOemEulaURLPath) {
240 // Load local OEM EULA from the disk. 245 // Load local OEM EULA from the disk.
241 BrowserThread::PostTask( 246 BrowserThread::PostTask(
242 BrowserThread::FILE, FROM_HERE, 247 BrowserThread::FILE, FROM_HERE,
243 base::Bind(&ChromeOSTermsHandler::LoadOemEulaFileOnFileThread, this)); 248 base::Bind(&ChromeOSTermsHandler::LoadOemEulaFileOnFileThread, this));
249 } else if (CommandLine::ForCurrentProcess()->HasSwitch(
250 chromeos::switches::kDisableOnlineEULA)) {
251 // Fallback to the local file.
252 BrowserThread::PostTask(
253 BrowserThread::FILE, FROM_HERE,
254 base::Bind(&ChromeOSTermsHandler::LoadEulaFileOnFileThread, this));
244 } else { 255 } else {
245 // Try to load online version of ChromeOS terms first. 256 // Try to load online version of ChromeOS terms first.
246 // ChromeOSOnlineTermsHandler object destroys itself. 257 // ChromeOSOnlineTermsHandler object destroys itself.
247 new ChromeOSOnlineTermsHandler( 258 new ChromeOSOnlineTermsHandler(
248 base::Bind(&ChromeOSTermsHandler::OnOnlineEULAFetched, this)); 259 base::Bind(&ChromeOSTermsHandler::OnOnlineEULAFetched, this));
249 } 260 }
250 } 261 }
251 262
252 void OnOnlineEULAFetched(ChromeOSOnlineTermsHandler* loader) { 263 void OnOnlineEULAFetched(ChromeOSOnlineTermsHandler* loader) {
253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 Profile* profile = Profile::FromWebUI(web_ui); 1176 Profile* profile = Profile::FromWebUI(web_ui);
1166 1177
1167 #if defined(ENABLE_THEMES) 1178 #if defined(ENABLE_THEMES)
1168 // Set up the chrome://theme/ source. 1179 // Set up the chrome://theme/ source.
1169 ThemeSource* theme = new ThemeSource(profile); 1180 ThemeSource* theme = new ThemeSource(profile);
1170 content::URLDataSource::Add(profile, theme); 1181 content::URLDataSource::Add(profile, theme);
1171 #endif 1182 #endif
1172 1183
1173 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); 1184 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile));
1174 } 1185 }
OLDNEW
« no previous file with comments | « no previous file | chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698