| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 val->SetString("model_type", ModelTypeToString(it->first)); | 771 val->SetString("model_type", ModelTypeToString(it->first)); |
| 772 val->SetString("group", ModelSafeGroupToString(it->second)); | 772 val->SetString("group", ModelSafeGroupToString(it->second)); |
| 773 routing_info->Append(val); | 773 routing_info->Append(val); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 | 776 |
| 777 static const base::StringPiece sync_html( | 777 static const base::StringPiece sync_html( |
| 778 ResourceBundle::GetSharedInstance().GetRawDataResource( | 778 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 779 IDR_ABOUT_SYNC_HTML)); | 779 IDR_ABOUT_SYNC_HTML)); |
| 780 | 780 |
| 781 return jstemplate_builder::GetTemplateHtml( | 781 return jstemplate_builder::GetTemplatesHtml( |
| 782 sync_html, &strings , "t" /* template root node id */); | 782 sync_html, &strings , "t" /* template root node id */); |
| 783 } | 783 } |
| 784 | 784 |
| 785 #if defined(OS_CHROMEOS) | 785 #if defined(OS_CHROMEOS) |
| 786 std::string AboutSys() { | 786 std::string AboutSys(const std::string& query) { |
| 787 DictionaryValue strings; | 787 DictionaryValue strings; |
| 788 strings.SetString("title", l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TITLE)); |
| 789 strings.SetString("description", |
| 790 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_DESC)); |
| 791 strings.SetString("table_title", |
| 792 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TABLE_TITLE)); |
| 793 strings.SetString("expand_all_btn", |
| 794 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_EXPAND_ALL)); |
| 795 strings.SetString("collapse_all_btn", |
| 796 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_COLLAPSE_ALL)); |
| 797 strings.SetString("expand_btn", |
| 798 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_EXPAND)); |
| 799 strings.SetString("collapse_btn", |
| 800 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_COLLAPSE)); |
| 801 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&strings); |
| 802 |
| 788 chromeos::SyslogsLibrary* syslogs_lib = | 803 chromeos::SyslogsLibrary* syslogs_lib = |
| 789 chromeos::CrosLibrary::Get()->GetSyslogsLibrary(); | 804 chromeos::CrosLibrary::Get()->GetSyslogsLibrary(); |
| 790 scoped_ptr<chromeos::LogDictionaryType> sys_info; | 805 scoped_ptr<chromeos::LogDictionaryType> sys_info; |
| 791 if (syslogs_lib) | 806 if (syslogs_lib) |
| 792 sys_info.reset(syslogs_lib->GetSyslogs(new FilePath())); | 807 sys_info.reset(syslogs_lib->GetSyslogs(new FilePath())); |
| 793 if (sys_info.get()) { | 808 if (sys_info.get()) { |
| 794 ListValue* details = new ListValue(); | 809 ListValue* details = new ListValue(); |
| 795 strings.Set("details", details); | 810 strings.Set("details", details); |
| 796 chromeos::LogDictionaryType::iterator it; | 811 chromeos::LogDictionaryType::iterator it; |
| 797 | |
| 798 for (it = sys_info.get()->begin(); it != sys_info.get()->end(); ++it) { | 812 for (it = sys_info.get()->begin(); it != sys_info.get()->end(); ++it) { |
| 799 DictionaryValue* val = new DictionaryValue; | 813 DictionaryValue* val = new DictionaryValue; |
| 800 val->SetString("stat_name", (*it).first); | 814 val->SetString("stat_name", it->first); |
| 801 val->SetString("stat_value", (*it).second); | 815 val->SetString("stat_value", it->second); |
| 802 details->Append(val); | 816 details->Append(val); |
| 803 } | 817 } |
| 818 strings.SetString("anchor", query); |
| 804 } | 819 } |
| 805 static const base::StringPiece sys_html( | 820 static const base::StringPiece sys_html( |
| 806 ResourceBundle::GetSharedInstance().GetRawDataResource( | 821 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 807 IDR_ABOUT_SYS_HTML)); | 822 IDR_ABOUT_SYS_HTML)); |
| 808 | 823 |
| 809 return jstemplate_builder::GetTemplateHtml( | 824 return jstemplate_builder::GetTemplatesHtml( |
| 810 sys_html, &strings , "t" /* template root node id */); | 825 sys_html, &strings , "t" /* template root node id */); |
| 811 } | 826 } |
| 812 #endif | 827 #endif |
| 813 | 828 |
| 814 // AboutSource ----------------------------------------------------------------- | 829 // AboutSource ----------------------------------------------------------------- |
| 815 | 830 |
| 816 AboutSource::AboutSource() | 831 AboutSource::AboutSource() |
| 817 : DataSource(chrome::kAboutScheme, MessageLoop::current()) { | 832 : DataSource(chrome::kAboutScheme, MessageLoop::current()) { |
| 818 // This should be a singleton. | 833 // This should be a singleton. |
| 819 DCHECK(!about_source); | 834 DCHECK(!about_source); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 #if defined(OS_LINUX) | 905 #if defined(OS_LINUX) |
| 891 } else if (path == kLinuxProxyConfigPath) { | 906 } else if (path == kLinuxProxyConfigPath) { |
| 892 response = AboutLinuxProxyConfig(); | 907 response = AboutLinuxProxyConfig(); |
| 893 } else if (path == kSandboxPath) { | 908 } else if (path == kSandboxPath) { |
| 894 response = AboutSandbox(); | 909 response = AboutSandbox(); |
| 895 #endif | 910 #endif |
| 896 } else if (path == kSyncPath) { | 911 } else if (path == kSyncPath) { |
| 897 response = AboutSync(); | 912 response = AboutSync(); |
| 898 #if defined(OS_CHROMEOS) | 913 #if defined(OS_CHROMEOS) |
| 899 } else if (path == kSysPath) { | 914 } else if (path == kSysPath) { |
| 900 response = AboutSys(); | 915 response = AboutSys(info); |
| 901 #endif | 916 #endif |
| 902 } | 917 } |
| 903 | 918 |
| 904 FinishDataRequest(response, request_id); | 919 FinishDataRequest(response, request_id); |
| 905 } | 920 } |
| 906 | 921 |
| 907 void AboutSource::FinishDataRequest(const std::string& response, | 922 void AboutSource::FinishDataRequest(const std::string& response, |
| 908 int request_id) { | 923 int request_id) { |
| 909 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 924 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 910 html_bytes->data.resize(response.size()); | 925 html_bytes->data.resize(response.size()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 // Run the dialog. This will re-use the existing one if it's already up. | 1192 // Run the dialog. This will re-use the existing one if it's already up. |
| 1178 AboutIPCDialog::RunDialog(); | 1193 AboutIPCDialog::RunDialog(); |
| 1179 return true; | 1194 return true; |
| 1180 } | 1195 } |
| 1181 #endif | 1196 #endif |
| 1182 | 1197 |
| 1183 #endif // OFFICIAL_BUILD | 1198 #endif // OFFICIAL_BUILD |
| 1184 | 1199 |
| 1185 return false; | 1200 return false; |
| 1186 } | 1201 } |
| OLD | NEW |