| 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 "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| 11 #include "base/histogram.h" | 11 #include "base/histogram.h" |
| 12 #include "base/platform_thread.h" |
| 12 #include "base/stats_table.h" | 13 #include "base/stats_table.h" |
| 13 #include "base/string_piece.h" | 14 #include "base/string_piece.h" |
| 14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 15 #include "base/thread.h" | 16 #include "base/thread.h" |
| 16 #include "base/tracked_objects.h" | 17 #include "base/tracked_objects.h" |
| 17 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 20 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 20 #include "chrome/browser/memory_details.h" | 21 #include "chrome/browser/memory_details.h" |
| 21 #include "chrome/browser/net/dns_global.h" | 22 #include "chrome/browser/net/dns_global.h" |
| 22 #include "chrome/browser/profile.h" | 23 #include "chrome/browser/profile.h" |
| 23 #include "chrome/browser/profile_manager.h" | 24 #include "chrome/browser/profile_manager.h" |
| 25 #include "chrome/browser/renderer_host/render_process_host.h" |
| 24 #include "chrome/browser/renderer_host/render_view_host.h" | 26 #include "chrome/browser/renderer_host/render_view_host.h" |
| 25 #include "chrome/common/jstemplate_builder.h" | 27 #include "chrome/common/jstemplate_builder.h" |
| 26 #include "chrome/common/l10n_util.h" | 28 #include "chrome/common/l10n_util.h" |
| 27 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/pref_service.h" | 30 #include "chrome/common/pref_service.h" |
| 31 #include "chrome/common/render_messages.h" |
| 29 #include "chrome/common/resource_bundle.h" | 32 #include "chrome/common/resource_bundle.h" |
| 30 #include "chrome/renderer/about_handler.h" | 33 #include "chrome/renderer/about_handler.h" |
| 31 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 32 #include "grit/browser_resources.h" | 35 #include "grit/browser_resources.h" |
| 33 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 34 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 35 #include "grit/locale_settings.h" | 38 #include "grit/locale_settings.h" |
| 36 #include "webkit/glue/webkit_glue.h" | 39 #include "webkit/glue/webkit_glue.h" |
| 37 #ifdef CHROME_V8 | 40 #ifdef CHROME_V8 |
| 38 #include "v8/include/v8.h" | 41 #include "v8/include/v8.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 static const StringPiece version_html( | 288 static const StringPiece version_html( |
| 286 ResourceBundle::GetSharedInstance().GetRawDataResource( | 289 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 287 IDR_ABOUT_VERSION_HTML)); | 290 IDR_ABOUT_VERSION_HTML)); |
| 288 | 291 |
| 289 return jstemplate_builder::GetTemplateHtml( | 292 return jstemplate_builder::GetTemplateHtml( |
| 290 version_html, &localized_strings, "t" /* template root node id */); | 293 version_html, &localized_strings, "t" /* template root node id */); |
| 291 } | 294 } |
| 292 | 295 |
| 293 // static | 296 // static |
| 294 std::string BrowserAboutHandler::AboutCredits() { | 297 std::string BrowserAboutHandler::AboutCredits() { |
| 295 static const std::string credits_html = | 298 static const std::string credits_html = |
| 296 ResourceBundle::GetSharedInstance().GetDataResource( | 299 ResourceBundle::GetSharedInstance().GetDataResource( |
| 297 IDR_CREDITS_HTML); | 300 IDR_CREDITS_HTML); |
| 298 | 301 |
| 299 return credits_html; | 302 return credits_html; |
| 300 } | 303 } |
| 301 | 304 |
| 302 // static | 305 // static |
| 303 std::string BrowserAboutHandler::AboutTerms() { | 306 std::string BrowserAboutHandler::AboutTerms() { |
| 304 static const std::string terms_html = | 307 static const std::string terms_html = |
| 305 ResourceBundle::GetSharedInstance().GetDataResource( | 308 ResourceBundle::GetSharedInstance().GetDataResource( |
| 306 IDR_TERMS_HTML); | 309 IDR_TERMS_HTML); |
| 307 | 310 |
| 308 return terms_html; | 311 return terms_html; |
| 309 } | 312 } |
| 310 | 313 |
| 311 // static | 314 // static |
| 312 std::string BrowserAboutHandler::AboutPlugins() { | 315 std::string BrowserAboutHandler::AboutPlugins() { |
| 313 // Strings used in the JsTemplate file. | 316 // Strings used in the JsTemplate file. |
| 314 DictionaryValue localized_strings; | 317 DictionaryValue localized_strings; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 337 ResourceBundle::GetSharedInstance().GetRawDataResource( | 340 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 338 IDR_ABOUT_PLUGINS_HTML)); | 341 IDR_ABOUT_PLUGINS_HTML)); |
| 339 | 342 |
| 340 return jstemplate_builder::GetTemplateHtml( | 343 return jstemplate_builder::GetTemplateHtml( |
| 341 plugins_html, &localized_strings, "t" /* template root node id */); | 344 plugins_html, &localized_strings, "t" /* template root node id */); |
| 342 } | 345 } |
| 343 | 346 |
| 344 // static | 347 // static |
| 345 std::string BrowserAboutHandler::AboutHistograms(const std::string& query) { | 348 std::string BrowserAboutHandler::AboutHistograms(const std::string& query) { |
| 346 std::string data; | 349 std::string data; |
| 350 for (RenderProcessHost::iterator it = RenderProcessHost::begin(); |
| 351 it != RenderProcessHost::end(); ++it) { |
| 352 it->second->Send(new ViewMsg_GetRendererHistograms()); |
| 353 } |
| 354 |
| 355 // TODO(raman): Delay page layout until we get respnoses |
| 356 // back from renderers, and not have to use a fixed size delay. |
| 357 PlatformThread::Sleep(1000); |
| 358 |
| 347 StatisticsRecorder::WriteHTMLGraph(query, &data); | 359 StatisticsRecorder::WriteHTMLGraph(query, &data); |
| 348 return data; | 360 return data; |
| 349 } | 361 } |
| 350 | 362 |
| 351 // static | 363 // static |
| 352 std::string BrowserAboutHandler::AboutObjects(const std::string& query) { | 364 std::string BrowserAboutHandler::AboutObjects(const std::string& query) { |
| 353 std::string data; | 365 std::string data; |
| 354 tracked_objects::ThreadData::WriteHTML(query, &data); | 366 tracked_objects::ThreadData::WriteHTML(query, &data); |
| 355 return data; | 367 return data; |
| 356 } | 368 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 614 |
| 603 AboutSource* about_source = static_cast<AboutSource*>(source_); | 615 AboutSource* about_source = static_cast<AboutSource*>(source_); |
| 604 about_source->FinishDataRequest(template_html, request_id_); | 616 about_source->FinishDataRequest(template_html, request_id_); |
| 605 } | 617 } |
| 606 | 618 |
| 607 // static | 619 // static |
| 608 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) { | 620 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) { |
| 609 // The AboutMemoryHandler cleans itself up. | 621 // The AboutMemoryHandler cleans itself up. |
| 610 new AboutMemoryHandler(source, request_id); | 622 new AboutMemoryHandler(source, request_id); |
| 611 } | 623 } |
| OLD | NEW |