Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/browser/ui/webui/workers_ui.cc

Issue 9003014: Replace WebUI::tab_contents() with web_contents() and switch all users to use web_contents.h inst... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/workers_ui.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/debugger/devtools_window.h" 14 #include "chrome/browser/debugger/devtools_window.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "content/public/browser/devtools_agent_host_registry.h" 19 #include "content/public/browser/devtools_agent_host_registry.h"
20 #include "content/browser/tab_contents/tab_contents.h"
21 #include "content/browser/worker_host/worker_process_host.h" 20 #include "content/browser/worker_host/worker_process_host.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/web_contents.h"
23 #include "content/public/browser/worker_service.h" 23 #include "content/public/browser/worker_service.h"
24 #include "content/public/browser/worker_service_observer.h" 24 #include "content/public/browser/worker_service_observer.h"
25 #include "content/public/common/process_type.h" 25 #include "content/public/common/process_type.h"
26 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
27 #include "grit/workers_resources.h" 27 #include "grit/workers_resources.h"
28 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
29 29
30 using content::BrowserThread; 30 using content::BrowserThread;
31 using content::DevToolsAgentHost; 31 using content::DevToolsAgentHost;
32 using content::DevToolsAgentHostRegistry; 32 using content::DevToolsAgentHostRegistry;
33 using content::WebContents;
33 using content::WorkerService; 34 using content::WorkerService;
34 using content::WorkerServiceObserver; 35 using content::WorkerServiceObserver;
35 36
36 static const char kWorkersDataFile[] = "workers_data.json"; 37 static const char kWorkersDataFile[] = "workers_data.json";
37 38
38 static const char kOpenDevToolsCommand[] = "openDevTools"; 39 static const char kOpenDevToolsCommand[] = "openDevTools";
39 static const char kTerminateWorkerCommand[] = "terminateWorker"; 40 static const char kTerminateWorkerCommand[] = "terminateWorker";
40 41
41 static const char kWorkerProcessHostIdField[] = "workerProcessHostId"; 42 static const char kWorkerProcessHostIdField[] = "workerProcessHostId";
42 static const char kWorkerRouteIdField[] = "workerRouteId"; 43 static const char kWorkerRouteIdField[] = "workerRouteId";
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void RegisterObserver() { 243 void RegisterObserver() {
243 WorkerService::GetInstance()->AddObserver(this); 244 WorkerService::GetInstance()->AddObserver(this);
244 } 245 }
245 void UnregisterObserver() { 246 void UnregisterObserver() {
246 WorkerService::GetInstance()->RemoveObserver(this); 247 WorkerService::GetInstance()->RemoveObserver(this);
247 } 248 }
248 249
249 WorkersUI* workers_ui_; 250 WorkersUI* workers_ui_;
250 }; 251 };
251 252
252 WorkersUI::WorkersUI(TabContents* contents) 253 WorkersUI::WorkersUI(WebContents* contents)
253 : ChromeWebUI(contents), 254 : ChromeWebUI(contents),
254 observer_(new WorkerCreationDestructionListener(this)){ 255 observer_(new WorkerCreationDestructionListener(this)){
255 AddMessageHandler(new WorkersDOMHandler()); 256 AddMessageHandler(new WorkersDOMHandler());
256 257
257 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource(); 258 WorkersUIHTMLSource* html_source = new WorkersUIHTMLSource();
258 259
259 // Set up the chrome://workers/ source. 260 // Set up the chrome://workers/ source.
260 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 261 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
261 profile->GetChromeURLDataManager()->AddDataSource(html_source); 262 profile->GetChromeURLDataManager()->AddDataSource(html_source);
262 } 263 }
263 264
264 WorkersUI::~WorkersUI() { 265 WorkersUI::~WorkersUI() {
265 observer_->WorkersUIDestroyed(); 266 observer_->WorkersUIDestroyed();
266 observer_ = NULL; 267 observer_ = NULL;
267 } 268 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/workers_ui.h ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698