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" | 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 WorkerService::GetInstance()->AddObserver(this); | 246 WorkerService::GetInstance()->AddObserver(this); |
247 } | 247 } |
248 void UnregisterObserver() { | 248 void UnregisterObserver() { |
249 WorkerService::GetInstance()->RemoveObserver(this); | 249 WorkerService::GetInstance()->RemoveObserver(this); |
250 } | 250 } |
251 | 251 |
252 WorkersUI* workers_ui_; | 252 WorkersUI* workers_ui_; |
253 }; | 253 }; |
254 | 254 |
255 WorkersUI::WorkersUI(WebContents* contents) | 255 WorkersUI::WorkersUI(WebContents* contents) |
256 : WebUI(contents), | 256 : WebUI(contents, this), |
257 observer_(new WorkerCreationDestructionListener(this)){ | 257 observer_(new WorkerCreationDestructionListener(this)){ |
258 AddMessageHandler(new WorkersDOMHandler()); | 258 AddMessageHandler(new WorkersDOMHandler()); |
259 | 259 |
260 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); | 260 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); |
261 | 261 |
262 // Set up the chrome://workers/ source. | 262 // Set up the chrome://workers/ source. |
263 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 263 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
264 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 264 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
265 } | 265 } |
266 | 266 |
267 WorkersUI::~WorkersUI() { | 267 WorkersUI::~WorkersUI() { |
268 observer_->WorkersUIDestroyed(); | 268 observer_->WorkersUIDestroyed(); |
269 observer_ = NULL; | 269 observer_ = NULL; |
270 } | 270 } |
OLD | NEW |