| 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 17 matching lines...) Expand all Loading... |
| 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" | 36 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 38 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
| 38 #include "chrome/browser/chrome_notification_types.h" | 39 #include "chrome/browser/chrome_notification_types.h" |
| 39 #include "chrome/browser/download/download_prefs.h" | 40 #include "chrome/browser/download/download_prefs.h" |
| 40 #include "chrome/browser/io_thread.h" | 41 #include "chrome/browser/io_thread.h" |
| 41 #include "chrome/browser/net/chrome_network_delegate.h" | 42 #include "chrome/browser/net/chrome_network_delegate.h" |
| 42 #include "chrome/browser/net/net_export_helper.h" | 43 #include "chrome/browser/net/net_export_helper.h" |
| 43 #include "chrome/browser/profiles/profile.h" | 44 #include "chrome/browser/profiles/profile.h" |
| 44 #include "chrome/common/channel_info.h" | 45 #include "chrome/common/channel_info.h" |
| 45 #include "chrome/common/chrome_paths.h" | 46 #include "chrome/common/chrome_paths.h" |
| 46 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
| 47 #include "chrome/grit/net_internals_resources.h" | 48 #include "chrome/grit/net_internals_resources.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 498 |
| 498 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { | 499 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { |
| 499 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); | 500 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); |
| 500 } | 501 } |
| 501 | 502 |
| 502 void NetInternalsMessageHandler::OnClearBrowserCache( | 503 void NetInternalsMessageHandler::OnClearBrowserCache( |
| 503 const base::ListValue* list) { | 504 const base::ListValue* list) { |
| 504 BrowsingDataRemover* remover = | 505 BrowsingDataRemover* remover = |
| 505 BrowsingDataRemoverFactory::GetForBrowserContext( | 506 BrowsingDataRemoverFactory::GetForBrowserContext( |
| 506 Profile::FromWebUI(web_ui())); | 507 Profile::FromWebUI(web_ui())); |
| 507 remover->Remove(base::Time(), base::Time::Max(), | 508 remover->Remove( |
| 508 BrowsingDataRemover::REMOVE_CACHE, | 509 base::Time(), base::Time::Max(), |
| 509 BrowsingDataHelper::UNPROTECTED_WEB); | 510 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CACHE, |
| 511 ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_UNPROTECTED_WEB); |
| 510 // BrowsingDataRemover deletes itself. | 512 // BrowsingDataRemover deletes itself. |
| 511 } | 513 } |
| 512 | 514 |
| 513 void NetInternalsMessageHandler::OnGetPrerenderInfo( | 515 void NetInternalsMessageHandler::OnGetPrerenderInfo( |
| 514 const base::ListValue* list) { | 516 const base::ListValue* list) { |
| 515 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 517 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 516 SendJavascriptCommand( | 518 SendJavascriptCommand( |
| 517 "receivedPrerenderInfo", | 519 "receivedPrerenderInfo", |
| 518 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); | 520 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); |
| 519 } | 521 } |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 //////////////////////////////////////////////////////////////////////////////// | 1056 //////////////////////////////////////////////////////////////////////////////// |
| 1055 | 1057 |
| 1056 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1058 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1057 : WebUIController(web_ui) { | 1059 : WebUIController(web_ui) { |
| 1058 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); | 1060 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); |
| 1059 | 1061 |
| 1060 // Set up the chrome://net-internals/ source. | 1062 // Set up the chrome://net-internals/ source. |
| 1061 Profile* profile = Profile::FromWebUI(web_ui); | 1063 Profile* profile = Profile::FromWebUI(web_ui); |
| 1062 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1064 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1063 } | 1065 } |
| OLD | NEW |