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/net_internals/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/sequenced_task_runner_helpers.h" | 26 #include "base/sequenced_task_runner_helpers.h" |
27 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_piece.h" | 28 #include "base/strings/string_piece.h" |
29 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
30 #include "base/strings/string_util.h" | 30 #include "base/strings/string_util.h" |
31 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
32 #include "base/values.h" | 32 #include "base/values.h" |
33 #include "build/build_config.h" | 33 #include "build/build_config.h" |
34 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
35 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 35 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
36 #include "chrome/browser/browsing_data/browsing_data_remover.h" | |
37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | |
38 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 36 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
39 #include "chrome/browser/chrome_notification_types.h" | 37 #include "chrome/browser/chrome_notification_types.h" |
40 #include "chrome/browser/download/download_prefs.h" | 38 #include "chrome/browser/download/download_prefs.h" |
41 #include "chrome/browser/io_thread.h" | 39 #include "chrome/browser/io_thread.h" |
42 #include "chrome/browser/net/chrome_network_delegate.h" | 40 #include "chrome/browser/net/chrome_network_delegate.h" |
43 #include "chrome/browser/net/net_export_helper.h" | 41 #include "chrome/browser/net/net_export_helper.h" |
44 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
45 #include "chrome/common/channel_info.h" | 43 #include "chrome/common/channel_info.h" |
46 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
47 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
48 #include "chrome/grit/net_internals_resources.h" | 46 #include "chrome/grit/net_internals_resources.h" |
49 #include "components/net_log/chrome_net_log.h" | 47 #include "components/net_log/chrome_net_log.h" |
50 #include "components/onc/onc_constants.h" | 48 #include "components/onc/onc_constants.h" |
51 #include "components/prefs/pref_member.h" | 49 #include "components/prefs/pref_member.h" |
52 #include "components/url_formatter/url_fixer.h" | 50 #include "components/url_formatter/url_fixer.h" |
53 #include "components/version_info/version_info.h" | 51 #include "components/version_info/version_info.h" |
54 #include "content/public/browser/browser_thread.h" | 52 #include "content/public/browser/browser_thread.h" |
| 53 #include "content/public/browser/browsing_data_remover.h" |
55 #include "content/public/browser/notification_details.h" | 54 #include "content/public/browser/notification_details.h" |
56 #include "content/public/browser/resource_dispatcher_host.h" | 55 #include "content/public/browser/resource_dispatcher_host.h" |
57 #include "content/public/browser/storage_partition.h" | 56 #include "content/public/browser/storage_partition.h" |
58 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
59 #include "content/public/browser/web_ui.h" | 58 #include "content/public/browser/web_ui.h" |
60 #include "content/public/browser/web_ui_data_source.h" | 59 #include "content/public/browser/web_ui_data_source.h" |
61 #include "content/public/browser/web_ui_message_handler.h" | 60 #include "content/public/browser/web_ui_message_handler.h" |
62 #include "net/base/net_errors.h" | 61 #include "net/base/net_errors.h" |
63 #include "net/disk_cache/disk_cache.h" | 62 #include "net/disk_cache/disk_cache.h" |
64 #include "net/dns/host_cache.h" | 63 #include "net/dns/host_cache.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 *command_value.get()); | 494 *command_value.get()); |
496 } | 495 } |
497 } | 496 } |
498 | 497 |
499 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { | 498 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { |
500 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); | 499 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); |
501 } | 500 } |
502 | 501 |
503 void NetInternalsMessageHandler::OnClearBrowserCache( | 502 void NetInternalsMessageHandler::OnClearBrowserCache( |
504 const base::ListValue* list) { | 503 const base::ListValue* list) { |
505 BrowsingDataRemover* remover = | 504 content::BrowsingDataRemover* remover = |
506 BrowsingDataRemoverFactory::GetForBrowserContext( | 505 Profile::GetBrowsingDataRemover(Profile::FromWebUI(web_ui())); |
507 Profile::FromWebUI(web_ui())); | |
508 remover->Remove(base::Time(), base::Time::Max(), | 506 remover->Remove(base::Time(), base::Time::Max(), |
509 BrowsingDataRemover::DATA_TYPE_CACHE, | 507 content::BrowsingDataRemover::DATA_TYPE_CACHE, |
510 BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB); | 508 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB); |
511 // BrowsingDataRemover deletes itself. | 509 // BrowsingDataRemover deletes itself. |
512 } | 510 } |
513 | 511 |
514 void NetInternalsMessageHandler::OnGetPrerenderInfo( | 512 void NetInternalsMessageHandler::OnGetPrerenderInfo( |
515 const base::ListValue* list) { | 513 const base::ListValue* list) { |
516 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 514 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
517 SendJavascriptCommand( | 515 SendJavascriptCommand( |
518 "receivedPrerenderInfo", | 516 "receivedPrerenderInfo", |
519 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); | 517 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); |
520 } | 518 } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 //////////////////////////////////////////////////////////////////////////////// | 1053 //////////////////////////////////////////////////////////////////////////////// |
1056 | 1054 |
1057 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1055 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1058 : WebUIController(web_ui) { | 1056 : WebUIController(web_ui) { |
1059 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); | 1057 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); |
1060 | 1058 |
1061 // Set up the chrome://net-internals/ source. | 1059 // Set up the chrome://net-internals/ source. |
1062 Profile* profile = Profile::FromWebUI(web_ui); | 1060 Profile* profile = Profile::FromWebUI(web_ui); |
1063 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1061 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1064 } | 1062 } |
OLD | NEW |