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/workers_ui.h" | 5 #include "chrome/browser/ui/webui/workers_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 ListValue workers_list; | 100 ListValue workers_list; |
101 std::vector<WorkerService::WorkerInfo> worker_info = | 101 std::vector<WorkerService::WorkerInfo> worker_info = |
102 WorkerService::GetInstance()->GetWorkers(); | 102 WorkerService::GetInstance()->GetWorkers(); |
103 for (size_t i = 0; i < worker_info.size(); ++i) { | 103 for (size_t i = 0; i < worker_info.size(); ++i) { |
104 workers_list.Append(BuildWorkerData( | 104 workers_list.Append(BuildWorkerData( |
105 worker_info[i].url, worker_info[i].name, worker_info[i].process_id, | 105 worker_info[i].url, worker_info[i].name, worker_info[i].process_id, |
106 worker_info[i].route_id, worker_info[i].handle)); | 106 worker_info[i].route_id, worker_info[i].handle)); |
107 } | 107 } |
108 | 108 |
109 std::string json_string; | 109 std::string json_string; |
110 base::JSONWriter::Write(&workers_list, false, &json_string); | 110 base::JSONWriter::Write(&workers_list, &json_string); |
111 | 111 |
112 SendResponse(request_id, base::RefCountedString::TakeString(&json_string)); | 112 SendResponse(request_id, base::RefCountedString::TakeString(&json_string)); |
113 } | 113 } |
114 | 114 |
115 class WorkersDOMHandler : public WebUIMessageHandler { | 115 class WorkersDOMHandler : public WebUIMessageHandler { |
116 public: | 116 public: |
117 WorkersDOMHandler() {} | 117 WorkersDOMHandler() {} |
118 virtual ~WorkersDOMHandler() {} | 118 virtual ~WorkersDOMHandler() {} |
119 | 119 |
120 private: | 120 private: |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 // Set up the chrome://workers/ source. | 263 // Set up the chrome://workers/ source. |
264 Profile* profile = Profile::FromWebUI(web_ui); | 264 Profile* profile = Profile::FromWebUI(web_ui); |
265 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 265 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
266 } | 266 } |
267 | 267 |
268 WorkersUI::~WorkersUI() { | 268 WorkersUI::~WorkersUI() { |
269 observer_->WorkersUIDestroyed(); | 269 observer_->WorkersUIDestroyed(); |
270 observer_ = NULL; | 270 observer_ = NULL; |
271 } | 271 } |
OLD | NEW |