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> |
| 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/base64.h" | 16 #include "base/base64.h" |
16 #include "base/bind.h" | 17 #include "base/bind.h" |
17 #include "base/bind_helpers.h" | 18 #include "base/bind_helpers.h" |
18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
19 #include "base/files/file.h" | 20 #include "base/files/file.h" |
20 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
21 #include "base/files/file_util.h" | 22 #include "base/files/file_util.h" |
22 #include "base/macros.h" | 23 #include "base/macros.h" |
23 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
24 #include "base/memory/weak_ptr.h" | 25 #include "base/memory/weak_ptr.h" |
25 #include "base/message_loop/message_loop.h" | 26 #include "base/message_loop/message_loop.h" |
26 #include "base/sequenced_task_runner_helpers.h" | 27 #include "base/sequenced_task_runner_helpers.h" |
27 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_piece.h" | 29 #include "base/strings/string_piece.h" |
29 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
30 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
31 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
32 #include "base/values.h" | 33 #include "base/values.h" |
33 #include "build/build_config.h" | 34 #include "build/build_config.h" |
34 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
35 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 36 #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.h" |
37 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 38 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 39 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
38 #include "chrome/browser/chrome_notification_types.h" | 40 #include "chrome/browser/chrome_notification_types.h" |
39 #include "chrome/browser/download/download_prefs.h" | 41 #include "chrome/browser/download/download_prefs.h" |
40 #include "chrome/browser/io_thread.h" | 42 #include "chrome/browser/io_thread.h" |
41 #include "chrome/browser/net/chrome_network_delegate.h" | 43 #include "chrome/browser/net/chrome_network_delegate.h" |
42 #include "chrome/browser/net/net_export_helper.h" | 44 #include "chrome/browser/net/net_export_helper.h" |
43 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
44 #include "chrome/common/channel_info.h" | 46 #include "chrome/common/channel_info.h" |
45 #include "chrome/common/chrome_paths.h" | 47 #include "chrome/common/chrome_paths.h" |
46 #include "chrome/common/url_constants.h" | 48 #include "chrome/common/url_constants.h" |
47 #include "chrome/grit/net_internals_resources.h" | 49 #include "chrome/grit/net_internals_resources.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 499 |
498 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { | 500 void NetInternalsMessageHandler::OnRendererReady(const base::ListValue* list) { |
499 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); | 501 IOThreadImpl::CallbackHelper(&IOThreadImpl::OnRendererReady, proxy_, list); |
500 } | 502 } |
501 | 503 |
502 void NetInternalsMessageHandler::OnClearBrowserCache( | 504 void NetInternalsMessageHandler::OnClearBrowserCache( |
503 const base::ListValue* list) { | 505 const base::ListValue* list) { |
504 BrowsingDataRemover* remover = | 506 BrowsingDataRemover* remover = |
505 BrowsingDataRemoverFactory::GetForBrowserContext( | 507 BrowsingDataRemoverFactory::GetForBrowserContext( |
506 Profile::FromWebUI(web_ui())); | 508 Profile::FromWebUI(web_ui())); |
507 remover->Remove(base::Time(), base::Time::Max(), | 509 remover->Remove(base::Time(), base::Time::Max(), {&kBrowsingDataTypeCache}, |
508 BrowsingDataRemover::REMOVE_CACHE, | |
509 BrowsingDataHelper::UNPROTECTED_WEB); | 510 BrowsingDataHelper::UNPROTECTED_WEB); |
510 // BrowsingDataRemover deletes itself. | 511 // BrowsingDataRemover deletes itself. |
511 } | 512 } |
512 | 513 |
513 void NetInternalsMessageHandler::OnGetPrerenderInfo( | 514 void NetInternalsMessageHandler::OnGetPrerenderInfo( |
514 const base::ListValue* list) { | 515 const base::ListValue* list) { |
515 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 516 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
516 SendJavascriptCommand( | 517 SendJavascriptCommand( |
517 "receivedPrerenderInfo", | 518 "receivedPrerenderInfo", |
518 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); | 519 chrome_browser_net::GetPrerenderInfo(Profile::FromWebUI(web_ui()))); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 //////////////////////////////////////////////////////////////////////////////// | 1056 //////////////////////////////////////////////////////////////////////////////// |
1056 | 1057 |
1057 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1058 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1058 : WebUIController(web_ui) { | 1059 : WebUIController(web_ui) { |
1059 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); | 1060 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); |
1060 | 1061 |
1061 // Set up the chrome://net-internals/ source. | 1062 // Set up the chrome://net-internals/ source. |
1062 Profile* profile = Profile::FromWebUI(web_ui); | 1063 Profile* profile = Profile::FromWebUI(web_ui); |
1063 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1064 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1064 } | 1065 } |
OLD | NEW |