| 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/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 CHECK(args->GetSize() == 2); | 133 CHECK(args->GetSize() == 2); |
| 134 CHECK(args->GetString(0, &worker_process_host_id_str)); | 134 CHECK(args->GetString(0, &worker_process_host_id_str)); |
| 135 CHECK(args->GetString(1, &worker_route_id_str)); | 135 CHECK(args->GetString(1, &worker_route_id_str)); |
| 136 CHECK(base::StringToInt(worker_process_host_id_str, | 136 CHECK(base::StringToInt(worker_process_host_id_str, |
| 137 &worker_process_host_id)); | 137 &worker_process_host_id)); |
| 138 CHECK(base::StringToInt(worker_route_id_str, &worker_route_id)); | 138 CHECK(base::StringToInt(worker_route_id_str, &worker_route_id)); |
| 139 | 139 |
| 140 if (WorkerDevToolsManagerIO::HasDevToolsClient(worker_process_host_id, | 140 if (WorkerDevToolsManagerIO::HasDevToolsClient(worker_process_host_id, |
| 141 worker_route_id)) | 141 worker_route_id)) |
| 142 return; | 142 return; |
| 143 Profile* profile = web_ui_->GetProfile(); | 143 Profile* profile = Profile::FromWebUI(web_ui_); |
| 144 if (!profile) | 144 if (!profile) |
| 145 return; | 145 return; |
| 146 DevToolsWindow* window = DevToolsWindow::CreateDevToolsWindowForWorker( | 146 DevToolsWindow* window = DevToolsWindow::CreateDevToolsWindowForWorker( |
| 147 profile); | 147 profile); |
| 148 window->Show(DEVTOOLS_TOGGLE_ACTION_NONE); | 148 window->Show(DEVTOOLS_TOGGLE_ACTION_NONE); |
| 149 WorkerDevToolsManagerIO::RegisterDevToolsClientForWorkerOnUIThread( | 149 WorkerDevToolsManagerIO::RegisterDevToolsClientForWorkerOnUIThread( |
| 150 window, | 150 window, |
| 151 worker_process_host_id, | 151 worker_process_host_id, |
| 152 worker_route_id); | 152 worker_route_id); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| 156 | 156 |
| 157 WorkersUI::WorkersUI(TabContents* contents) : ChromeWebUI(contents) { | 157 WorkersUI::WorkersUI(TabContents* contents) : ChromeWebUI(contents) { |
| 158 WorkersDOMHandler* handler = new WorkersDOMHandler(); | 158 WorkersDOMHandler* handler = new WorkersDOMHandler(); |
| 159 AddMessageHandler(handler); | 159 AddMessageHandler(handler); |
| 160 handler->Attach(this); | 160 handler->Attach(this); |
| 161 | 161 |
| 162 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); | 162 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); |
| 163 | 163 |
| 164 // Set up the chrome://workers/ source. | 164 // Set up the chrome://workers/ source. |
| 165 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 165 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 166 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 166 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 167 } | 167 } |
| OLD | NEW |