| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 12 #include "base/histogram.h" | 12 #include "base/histogram.h" |
| 13 #include "base/platform_thread.h" | 13 #include "base/platform_thread.h" |
| 14 #include "base/stats_table.h" | 14 #include "base/stats_table.h" |
| 15 #include "base/string_piece.h" | 15 #include "base/string_piece.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/thread.h" | 17 #include "base/thread.h" |
| 18 #include "base/tracked_objects.h" | 18 #include "base/tracked_objects.h" |
| 19 #include "chrome/browser/browser.h" | 19 #include "chrome/browser/browser.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 21 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 22 #include "chrome/browser/memory_details.h" | 22 #include "chrome/browser/memory_details.h" |
| 23 #include "chrome/browser/net/dns_global.h" | 23 #include "chrome/browser/net/dns_global.h" |
| 24 #include "chrome/browser/renderer_host/render_process_host.h" | 24 #include "chrome/browser/renderer_host/render_process_host.h" |
| 25 #include "chrome/browser/renderer_host/render_view_host.h" | 25 #include "chrome/browser/renderer_host/render_view_host.h" |
| 26 #include "chrome/common/histogram_synchronizer.h" |
| 26 #include "chrome/common/jstemplate_builder.h" | 27 #include "chrome/common/jstemplate_builder.h" |
| 27 #include "chrome/common/l10n_util.h" | 28 #include "chrome/common/l10n_util.h" |
| 28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/pref_service.h" | 30 #include "chrome/common/pref_service.h" |
| 30 #include "chrome/common/render_messages.h" | 31 #include "chrome/common/render_messages.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/renderer/about_handler.h" | 33 #include "chrome/renderer/about_handler.h" |
| 33 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 34 #include "grit/browser_resources.h" | 35 #include "grit/browser_resources.h" |
| 35 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #include "grit/locale_settings.h" | 38 #include "grit/locale_settings.h" |
| 38 #include "webkit/glue/webkit_glue.h" | 39 #include "webkit/glue/webkit_glue.h" |
| 39 #ifdef CHROME_V8 | 40 #ifdef CHROME_V8 |
| 40 #include "v8/include/v8.h" | 41 #include "v8/include/v8.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 44 #include "chrome/browser/views/about_ipc_dialog.h" | 45 #include "chrome/browser/views/about_ipc_dialog.h" |
| 45 #include "chrome/browser/views/about_network_dialog.h" | 46 #include "chrome/browser/views/about_network_dialog.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 49 using base::Time; |
| 50 using base::TimeDelta; |
| 51 |
| 48 namespace { | 52 namespace { |
| 49 | 53 |
| 50 // The paths used for the about pages. | 54 // The paths used for the about pages. |
| 51 const char kCachePath[] = "cache"; | 55 const char kCachePath[] = "cache"; |
| 52 const char kDnsPath[] = "dns"; | 56 const char kDnsPath[] = "dns"; |
| 53 const char kHistogramsPath[] = "histograms"; | 57 const char kHistogramsPath[] = "histograms"; |
| 54 const char kObjectsPath[] = "objects"; | 58 const char kObjectsPath[] = "objects"; |
| 55 const char kMemoryRedirectPath[] = "memory-redirect"; | 59 const char kMemoryRedirectPath[] = "memory-redirect"; |
| 56 const char kMemoryPath[] = "memory"; | 60 const char kMemoryPath[] = "memory"; |
| 57 const char kPluginsPath[] = "plugins"; | 61 const char kPluginsPath[] = "plugins"; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return credits_html; | 134 return credits_html; |
| 131 } | 135 } |
| 132 | 136 |
| 133 std::string AboutDns() { | 137 std::string AboutDns() { |
| 134 std::string data; | 138 std::string data; |
| 135 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data); | 139 chrome_browser_net::DnsPrefetchGetHtmlInfo(&data); |
| 136 return data; | 140 return data; |
| 137 } | 141 } |
| 138 | 142 |
| 139 std::string AboutHistograms(const std::string& query) { | 143 std::string AboutHistograms(const std::string& query) { |
| 144 TimeDelta wait_time = TimeDelta::FromMilliseconds(1000); |
| 145 |
| 146 HistogramSynchronizer* current_synchronizer = |
| 147 HistogramSynchronizer::CurrentSynchronizer(); |
| 148 DCHECK(current_synchronizer != NULL); |
| 149 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); |
| 150 |
| 140 std::string data; | 151 std::string data; |
| 141 for (RenderProcessHost::iterator it = RenderProcessHost::begin(); | |
| 142 it != RenderProcessHost::end(); ++it) { | |
| 143 it->second->Send(new ViewMsg_GetRendererHistograms()); | |
| 144 } | |
| 145 | |
| 146 // TODO(raman): Delay page layout until we get respnoses | |
| 147 // back from renderers, and not have to use a fixed size delay. | |
| 148 PlatformThread::Sleep(1000); | |
| 149 | |
| 150 StatisticsRecorder::WriteHTMLGraph(query, &data); | 152 StatisticsRecorder::WriteHTMLGraph(query, &data); |
| 151 return data; | 153 return data; |
| 152 } | 154 } |
| 153 | 155 |
| 154 std::string AboutLinuxSplash() { | 156 std::string AboutLinuxSplash() { |
| 155 static const std::string linux_splash_html = | 157 static const std::string linux_splash_html = |
| 156 ResourceBundle::GetSharedInstance().GetDataResource( | 158 ResourceBundle::GetSharedInstance().GetDataResource( |
| 157 IDR_LINUX_SPLASH_HTML); | 159 IDR_LINUX_SPLASH_HTML); |
| 158 | 160 |
| 159 return linux_splash_html; | 161 return linux_splash_html; |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 AboutIPCDialog::RunDialog(); | 645 AboutIPCDialog::RunDialog(); |
| 644 return true; | 646 return true; |
| 645 } | 647 } |
| 646 #endif | 648 #endif |
| 647 | 649 |
| 648 #else | 650 #else |
| 649 // TODO(port) Implement this. | 651 // TODO(port) Implement this. |
| 650 #endif | 652 #endif |
| 651 return false; | 653 return false; |
| 652 } | 654 } |
| OLD | NEW |