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/workers_ui.h" | 5 #include "chrome/browser/ui/webui/workers_ui.h" |
6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
7 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
8 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
9 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 12 #include "base/string_util.h" |
11 #include "base/values.h" | 13 #include "base/values.h" |
12 #include "chrome/browser/debugger/devtools_window.h" | 14 #include "chrome/browser/debugger/devtools_window.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 16 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
15 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
16 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 virtual void RegisterMessages() OVERRIDE; | 102 virtual void RegisterMessages() OVERRIDE; |
101 | 103 |
102 // Callback for "openDevTools" message. | 104 // Callback for "openDevTools" message. |
103 void HandleOpenDevTools(const ListValue* args); | 105 void HandleOpenDevTools(const ListValue* args); |
104 | 106 |
105 DISALLOW_COPY_AND_ASSIGN(WorkersDOMHandler); | 107 DISALLOW_COPY_AND_ASSIGN(WorkersDOMHandler); |
106 }; | 108 }; |
107 | 109 |
108 void WorkersDOMHandler::RegisterMessages() { | 110 void WorkersDOMHandler::RegisterMessages() { |
109 web_ui_->RegisterMessageCallback(kOpenDevToolsCommand, | 111 web_ui_->RegisterMessageCallback(kOpenDevToolsCommand, |
110 NewCallback(this, &WorkersDOMHandler::HandleOpenDevTools)); | 112 base::Bind(&WorkersDOMHandler::HandleOpenDevTools, |
| 113 base::Unretained(this))); |
111 } | 114 } |
112 | 115 |
113 void WorkersDOMHandler::HandleOpenDevTools(const ListValue* args) { | 116 void WorkersDOMHandler::HandleOpenDevTools(const ListValue* args) { |
114 std::string worker_process_host_id_str; | 117 std::string worker_process_host_id_str; |
115 std::string worker_route_id_str; | 118 std::string worker_route_id_str; |
116 int worker_process_host_id; | 119 int worker_process_host_id; |
117 int worker_route_id; | 120 int worker_route_id; |
118 CHECK(args->GetSize() == 2); | 121 CHECK(args->GetSize() == 2); |
119 CHECK(args->GetString(0, &worker_process_host_id_str)); | 122 CHECK(args->GetString(0, &worker_process_host_id_str)); |
120 CHECK(args->GetString(1, &worker_route_id_str)); | 123 CHECK(args->GetString(1, &worker_route_id_str)); |
(...skipping 23 matching lines...) Expand all Loading... |
144 WorkersDOMHandler* handler = new WorkersDOMHandler(); | 147 WorkersDOMHandler* handler = new WorkersDOMHandler(); |
145 AddMessageHandler(handler); | 148 AddMessageHandler(handler); |
146 handler->Attach(this); | 149 handler->Attach(this); |
147 | 150 |
148 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); | 151 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); |
149 | 152 |
150 // Set up the chrome://workers/ source. | 153 // Set up the chrome://workers/ source. |
151 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 154 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
152 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 155 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
153 } | 156 } |
OLD | NEW |