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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 | 274 |
275 void LoadOemEulaFileOnFileThread() { | 275 void LoadOemEulaFileOnFileThread() { |
276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
277 const chromeos::StartupCustomizationDocument* customization = | 277 const chromeos::StartupCustomizationDocument* customization = |
278 chromeos::StartupCustomizationDocument::GetInstance(); | 278 chromeos::StartupCustomizationDocument::GetInstance(); |
279 if (customization->IsReady()) { | 279 if (customization->IsReady()) { |
280 base::FilePath oem_eula_file_path; | 280 base::FilePath oem_eula_file_path; |
281 if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)), | 281 if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)), |
282 &oem_eula_file_path)) { | 282 &oem_eula_file_path)) { |
283 if (!file_util::ReadFileToString(oem_eula_file_path, &contents_)) { | 283 if (!base::ReadFileToString(oem_eula_file_path, &contents_)) { |
284 contents_.clear(); | 284 contents_.clear(); |
285 } | 285 } |
286 } | 286 } |
287 } | 287 } |
288 BrowserThread::PostTask( | 288 BrowserThread::PostTask( |
289 BrowserThread::UI, FROM_HERE, | 289 BrowserThread::UI, FROM_HERE, |
290 base::Bind(&ChromeOSTermsHandler::ResponseOnUIThread, this)); | 290 base::Bind(&ChromeOSTermsHandler::ResponseOnUIThread, this)); |
291 } | 291 } |
292 | 292 |
293 void LoadEulaFileOnFileThread() { | 293 void LoadEulaFileOnFileThread() { |
294 std::string file_path = | 294 std::string file_path = |
295 base::StringPrintf(chrome::kEULAPathFormat, locale_.c_str()); | 295 base::StringPrintf(chrome::kEULAPathFormat, locale_.c_str()); |
296 if (!file_util::ReadFileToString(base::FilePath(file_path), &contents_)) { | 296 if (!base::ReadFileToString(base::FilePath(file_path), &contents_)) { |
297 // No EULA for given language - try en-US as default. | 297 // No EULA for given language - try en-US as default. |
298 file_path = base::StringPrintf(chrome::kEULAPathFormat, "en-US"); | 298 file_path = base::StringPrintf(chrome::kEULAPathFormat, "en-US"); |
299 if (!file_util::ReadFileToString(base::FilePath(file_path), | 299 if (!base::ReadFileToString(base::FilePath(file_path), &contents_)) { |
300 &contents_)) { | |
301 // File with EULA not found, ResponseOnUIThread will load EULA from | 300 // File with EULA not found, ResponseOnUIThread will load EULA from |
302 // resources if contents_ is empty. | 301 // resources if contents_ is empty. |
303 contents_.clear(); | 302 contents_.clear(); |
304 } | 303 } |
305 } | 304 } |
306 BrowserThread::PostTask( | 305 BrowserThread::PostTask( |
307 BrowserThread::UI, FROM_HERE, | 306 BrowserThread::UI, FROM_HERE, |
308 base::Bind(&ChromeOSTermsHandler::ResponseOnUIThread, this)); | 307 base::Bind(&ChromeOSTermsHandler::ResponseOnUIThread, this)); |
309 } | 308 } |
310 | 309 |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 Profile* profile = Profile::FromWebUI(web_ui); | 1083 Profile* profile = Profile::FromWebUI(web_ui); |
1085 | 1084 |
1086 #if defined(ENABLE_THEMES) | 1085 #if defined(ENABLE_THEMES) |
1087 // Set up the chrome://theme/ source. | 1086 // Set up the chrome://theme/ source. |
1088 ThemeSource* theme = new ThemeSource(profile); | 1087 ThemeSource* theme = new ThemeSource(profile); |
1089 content::URLDataSource::Add(profile, theme); | 1088 content::URLDataSource::Add(profile, theme); |
1090 #endif | 1089 #endif |
1091 | 1090 |
1092 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 1091 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
1093 } | 1092 } |
OLD | NEW |