| 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/dom_ui/debugger_ui.h" | 5 #include "chrome/browser/dom_ui/debugger_ui.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return mime_type; | 83 return mime_type; |
| 84 } | 84 } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 DISALLOW_COPY_AND_ASSIGN(DebuggerHTMLSource); | 87 DISALLOW_COPY_AND_ASSIGN(DebuggerHTMLSource); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 | 90 |
| 91 class DebuggerHandler : public DOMMessageHandler { | 91 class DebuggerHandler : public DOMMessageHandler { |
| 92 public: | 92 public: |
| 93 explicit DebuggerHandler(DOMUI* dom_ui) : DOMMessageHandler(dom_ui) { | 93 DebuggerHandler() { } |
| 94 dom_ui->RegisterMessageCallback("DebuggerHostMessage", | 94 virtual ~DebuggerHandler() { } |
| 95 |
| 96 virtual void RegisterMessages() { |
| 97 dom_ui_->RegisterMessageCallback("DebuggerHostMessage", |
| 95 NewCallback(this, &DebuggerHandler::HandleDebuggerHostMessage)); | 98 NewCallback(this, &DebuggerHandler::HandleDebuggerHostMessage)); |
| 96 } | 99 } |
| 97 | 100 |
| 98 void HandleDebuggerHostMessage(const Value* content) { | 101 void HandleDebuggerHostMessage(const Value* content) { |
| 99 if (!content || !content->IsType(Value::TYPE_LIST)) { | 102 if (!content || !content->IsType(Value::TYPE_LIST)) { |
| 100 NOTREACHED(); | 103 NOTREACHED(); |
| 101 return; | 104 return; |
| 102 } | 105 } |
| 103 const ListValue* args = static_cast<const ListValue*>(content); | 106 const ListValue* args = static_cast<const ListValue*>(content); |
| 104 if (args->GetSize() < 1) { | 107 if (args->GetSize() < 1) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 #endif | 120 #endif |
| 118 } | 121 } |
| 119 | 122 |
| 120 private: | 123 private: |
| 121 DISALLOW_COPY_AND_ASSIGN(DebuggerHandler); | 124 DISALLOW_COPY_AND_ASSIGN(DebuggerHandler); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 } // namespace | 127 } // namespace |
| 125 | 128 |
| 126 DebuggerUI::DebuggerUI(TabContents* contents) : DOMUI(contents) { | 129 DebuggerUI::DebuggerUI(TabContents* contents) : DOMUI(contents) { |
| 127 AddMessageHandler(new DebuggerHandler(this)); | 130 AddMessageHandler((new DebuggerHandler())->Attach(this)); |
| 128 | 131 |
| 129 DebuggerHTMLSource* html_source = new DebuggerHTMLSource(); | 132 DebuggerHTMLSource* html_source = new DebuggerHTMLSource(); |
| 130 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 133 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
| 131 NewRunnableMethod(&chrome_url_data_manager, | 134 NewRunnableMethod(&chrome_url_data_manager, |
| 132 &ChromeURLDataManager::AddDataSource, | 135 &ChromeURLDataManager::AddDataSource, |
| 133 html_source)); | 136 html_source)); |
| 134 } | 137 } |
| OLD | NEW |