Chromium Code Reviews| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 using content::WebContents; | 104 using content::WebContents; |
| 105 | 105 |
| 106 namespace { | 106 namespace { |
| 107 | 107 |
| 108 const char kCreditsJsPath[] = "credits.js"; | 108 const char kCreditsJsPath[] = "credits.js"; |
| 109 const char kMemoryJsPath[] = "memory.js"; | 109 const char kMemoryJsPath[] = "memory.js"; |
| 110 const char kStatsJsPath[] = "stats.js"; | 110 const char kStatsJsPath[] = "stats.js"; |
| 111 const char kStringsJsPath[] = "strings.js"; | 111 const char kStringsJsPath[] = "strings.js"; |
| 112 const char kVersionJsPath[] = "version.js"; | 112 const char kVersionJsPath[] = "version.js"; |
| 113 | 113 |
| 114 #if defined(OS_ANDROID) | |
| 115 const char kWelcomeJsPath[] = "welcome.js"; | |
| 116 #endif | |
| 117 | |
| 114 // When you type about:memory, it actually loads this intermediate URL that | 118 // When you type about:memory, it actually loads this intermediate URL that |
| 115 // redirects you to the final page. This avoids the problem where typing | 119 // redirects you to the final page. This avoids the problem where typing |
| 116 // "about:memory" on the new tab page or any other page where a process | 120 // "about:memory" on the new tab page or any other page where a process |
| 117 // transition would occur to the about URL will cause some confusion. | 121 // transition would occur to the about URL will cause some confusion. |
| 118 // | 122 // |
| 119 // The problem is that during the processing of the memory page, there are two | 123 // The problem is that during the processing of the memory page, there are two |
| 120 // processes active, the original and the destination one. This can create the | 124 // processes active, the original and the destination one. This can create the |
| 121 // impression that we're using more resources than we actually are. This | 125 // impression that we're using more resources than we actually are. This |
| 122 // redirect solves the problem by eliminating the process transition during the | 126 // redirect solves the problem by eliminating the process transition during the |
| 123 // time that about memory is being computed. | 127 // time that about memory is being computed. |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1004 IDR_ABOUT_VERSION_HTML, ui::SCALE_FACTOR_NONE).as_string(); | 1008 IDR_ABOUT_VERSION_HTML, ui::SCALE_FACTOR_NONE).as_string(); |
| 1005 } | 1009 } |
| 1006 | 1010 |
| 1007 std::string AboutVersionStrings(DictionaryValue* localized_strings, | 1011 std::string AboutVersionStrings(DictionaryValue* localized_strings, |
| 1008 Profile* profile) { | 1012 Profile* profile) { |
| 1009 DCHECK(profile); | 1013 DCHECK(profile); |
| 1010 localized_strings->SetString("title", | 1014 localized_strings->SetString("title", |
| 1011 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE)); | 1015 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE)); |
| 1012 chrome::VersionInfo version_info; | 1016 chrome::VersionInfo version_info; |
| 1013 | 1017 |
| 1018 #if defined(OS_ANDROID) | |
| 1019 localized_strings->SetString("application", | |
| 1020 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_APPLICATION)); | |
| 1021 localized_strings->SetString("app_label", AboutAndroidApp::GetAppLabel()); | |
| 1022 localized_strings->SetString("app_version", | |
| 1023 AboutAndroidApp::GetAppVersionName()); | |
| 1024 #endif | |
| 1025 | |
| 1014 localized_strings->SetString("name", | 1026 localized_strings->SetString("name", |
| 1015 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 1027 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 1016 localized_strings->SetString("version", version_info.Version()); | 1028 localized_strings->SetString("version", version_info.Version()); |
| 1017 // Bug 79458: Need to evaluate the use of getting the version string on | 1029 // Bug 79458: Need to evaluate the use of getting the version string on |
| 1018 // this thread. | 1030 // this thread. |
| 1019 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1031 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 1020 localized_strings->SetString("version_modifier", | 1032 localized_strings->SetString("version_modifier", |
| 1021 chrome::VersionInfo::GetVersionStringModifier()); | 1033 chrome::VersionInfo::GetVersionStringModifier()); |
| 1022 localized_strings->SetString("os_name", | 1034 localized_strings->SetString("os_name", |
| 1023 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS)); | 1035 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS)); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1317 } else if (host == chrome::kChromeUITransparencyHost) { | 1329 } else if (host == chrome::kChromeUITransparencyHost) { |
| 1318 response = AboutTransparency(path); | 1330 response = AboutTransparency(path); |
| 1319 #endif | 1331 #endif |
| 1320 } else if (host == chrome::kChromeUIDNSHost) { | 1332 } else if (host == chrome::kChromeUIDNSHost) { |
| 1321 AboutDnsHandler::Start(this, request_id); | 1333 AboutDnsHandler::Start(this, request_id); |
| 1322 return; | 1334 return; |
| 1323 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 1335 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
| 1324 } else if (host == chrome::kChromeUILinuxProxyConfigHost) { | 1336 } else if (host == chrome::kChromeUILinuxProxyConfigHost) { |
| 1325 response = AboutLinuxProxyConfig(); | 1337 response = AboutLinuxProxyConfig(); |
| 1326 #endif | 1338 #endif |
| 1339 #if defined(OS_ANDROID) | |
| 1340 } else if (host == chrome::kChromeUIWelcomeHost) { | |
|
Evan Stade
2012/08/03 17:58:01
don't add more stuff to this crufty file. Please m
| |
| 1341 if (path == kStringsJsPath) { | |
| 1342 DictionaryValue* localized_strings = new DictionaryValue(); | |
| 1343 localized_strings->SetString("title", | |
| 1344 l10n_util::GetStringUTF16(IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE)); | |
| 1345 localized_strings->SetString("take_a_tour", | |
| 1346 l10n_util::GetStringUTF16(IDS_FIRSTRUN_TAKE_TOUR)); | |
| 1347 localized_strings->SetString("first_run_signed_in", | |
| 1348 l10n_util::GetStringUTF16(IDS_FIRSTRUN_SIGNED_IN)); | |
| 1349 localized_strings->SetString("settings", | |
| 1350 l10n_util::GetStringUTF16(IDS_FIRSTRUN_SETTINGS_LINK)); | |
| 1351 std::string json_js; | |
| 1352 jstemplate_builder::AppendJsonJS(localized_strings, &json_js); | |
| 1353 response = json_js; | |
| 1354 } else { | |
| 1355 int idr = (path == kWelcomeJsPath) ? IDR_WELCOME_JS : IDR_WELCOME_HTML; | |
| 1356 response = ResourceBundle::GetSharedInstance().GetRawDataResource( | |
| 1357 idr, ui::SCALE_FACTOR_NONE).as_string(); | |
| 1358 } | |
| 1359 #endif | |
| 1327 } else if (host == chrome::kChromeUIMemoryHost) { | 1360 } else if (host == chrome::kChromeUIMemoryHost) { |
| 1328 response = GetAboutMemoryRedirectResponse(profile()); | 1361 response = GetAboutMemoryRedirectResponse(profile()); |
| 1329 } else if (host == chrome::kChromeUIMemoryRedirectHost) { | 1362 } else if (host == chrome::kChromeUIMemoryRedirectHost) { |
| 1330 FinishMemoryDataRequest(path, this, request_id); | 1363 FinishMemoryDataRequest(path, this, request_id); |
| 1331 return; | 1364 return; |
| 1332 #if defined(OS_CHROMEOS) | 1365 #if defined(OS_CHROMEOS) |
| 1333 } else if (host == chrome::kChromeUINetworkHost) { | 1366 } else if (host == chrome::kChromeUINetworkHost) { |
| 1334 response = AboutNetwork(path); | 1367 response = AboutNetwork(path); |
| 1335 } else if (host == chrome::kChromeUIOSCreditsHost) { | 1368 } else if (host == chrome::kChromeUIOSCreditsHost) { |
| 1336 response = ResourceBundle::GetSharedInstance().GetRawDataResource( | 1369 response = ResourceBundle::GetSharedInstance().GetRawDataResource( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1391 ThemeSource* theme = new ThemeSource(profile); | 1424 ThemeSource* theme = new ThemeSource(profile); |
| 1392 ChromeURLDataManager::AddDataSource(profile, theme); | 1425 ChromeURLDataManager::AddDataSource(profile, theme); |
| 1393 #endif | 1426 #endif |
| 1394 | 1427 |
| 1395 ChromeURLDataManager::DataSource* source = | 1428 ChromeURLDataManager::DataSource* source = |
| 1396 new AboutUIHTMLSource(name, profile); | 1429 new AboutUIHTMLSource(name, profile); |
| 1397 if (source) { | 1430 if (source) { |
| 1398 ChromeURLDataManager::AddDataSource(profile, source); | 1431 ChromeURLDataManager::AddDataSource(profile, source); |
| 1399 } | 1432 } |
| 1400 } | 1433 } |
| OLD | NEW |