OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base64.h" | 13 #include "base/base64.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/message_loop_helpers.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
21 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
22 #include "base/string_split.h" | 23 #include "base/string_split.h" |
23 #include "base/string_util.h" | 24 #include "base/string_util.h" |
24 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
25 #include "base/values.h" | 26 #include "base/values.h" |
26 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/browsing_data_remover.h" | 28 #include "chrome/browser/browsing_data_remover.h" |
28 #include "chrome/browser/io_thread.h" | 29 #include "chrome/browser/io_thread.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log | 356 // and |arg|. Takes ownership of |arg|. If the renderer is displaying a log |
356 // file, the message will be ignored. Note that this can be called from any | 357 // file, the message will be ignored. Note that this can be called from any |
357 // thread. | 358 // thread. |
358 void SendJavascriptCommand(const std::string& command, Value* arg); | 359 void SendJavascriptCommand(const std::string& command, Value* arg); |
359 | 360 |
360 // Helper that runs |method| with |arg|, and deletes |arg| on completion. | 361 // Helper that runs |method| with |arg|, and deletes |arg| on completion. |
361 void DispatchToMessageHandler(ListValue* arg, MessageHandler method); | 362 void DispatchToMessageHandler(ListValue* arg, MessageHandler method); |
362 | 363 |
363 private: | 364 private: |
364 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 365 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
365 friend class DeleteTask<IOThreadImpl>; | 366 friend class base::DeleteHelper<IOThreadImpl>; |
366 | 367 |
367 ~IOThreadImpl(); | 368 ~IOThreadImpl(); |
368 | 369 |
369 // Adds |entry| to the queue of pending log entries to be sent to the page via | 370 // Adds |entry| to the queue of pending log entries to be sent to the page via |
370 // Javascript. Must be called on the IO Thread. Also creates a delayed task | 371 // Javascript. Must be called on the IO Thread. Also creates a delayed task |
371 // that will call PostPendingEntries, if there isn't one already. | 372 // that will call PostPendingEntries, if there isn't one already. |
372 void AddEntryToQueue(Value* entry); | 373 void AddEntryToQueue(Value* entry); |
373 | 374 |
374 // Sends all pending entries to the page via Javascript, and clears the list | 375 // Sends all pending entries to the page via Javascript, and clears the list |
375 // of pending entries. Sending multiple entries at once results in a | 376 // of pending entries. Sending multiple entries at once results in a |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 return constants_dict; | 1627 return constants_dict; |
1627 } | 1628 } |
1628 | 1629 |
1629 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { | 1630 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { |
1630 AddMessageHandler(new NetInternalsMessageHandler()); | 1631 AddMessageHandler(new NetInternalsMessageHandler()); |
1631 | 1632 |
1632 // Set up the chrome://net-internals/ source. | 1633 // Set up the chrome://net-internals/ source. |
1633 GetProfile()->GetChromeURLDataManager()->AddDataSource( | 1634 GetProfile()->GetChromeURLDataManager()->AddDataSource( |
1634 CreateNetInternalsHTMLSource()); | 1635 CreateNetInternalsHTMLSource()); |
1635 } | 1636 } |
OLD | NEW |