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

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

Issue 10196004: Changed ChromeURLDataManager to a ProfileKeyedService and made a Factory for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made ChromeURLDataManager's destructor virtual Created 8 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/keyboard_ui.cc » ('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) 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/inspect_ui.h" 5 #include "chrome/browser/ui/webui/inspect_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/debugger/devtools_window.h" 17 #include "chrome/browser/debugger/devtools_window.h"
18 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser_list.h" 20 #include "chrome/browser/ui/browser_list.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
22 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 22 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
23 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
23 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "content/public/browser/child_process_data.h" 26 #include "content/public/browser/child_process_data.h"
26 #include "content/public/browser/devtools_agent_host_registry.h" 27 #include "content/public/browser/devtools_agent_host_registry.h"
27 #include "content/public/browser/devtools_client_host.h" 28 #include "content/public/browser/devtools_client_host.h"
28 #include "content/public/browser/devtools_manager.h" 29 #include "content/public/browser/devtools_manager.h"
29 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/favicon_status.h" 31 #include "content/public/browser/favicon_status.h"
31 #include "content/public/browser/navigation_entry.h" 32 #include "content/public/browser/navigation_entry.h"
32 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 }; 376 };
376 377
377 InspectUI::InspectUI(content::WebUI* web_ui) 378 InspectUI::InspectUI(content::WebUI* web_ui)
378 : WebUIController(web_ui), 379 : WebUIController(web_ui),
379 observer_(new WorkerCreationDestructionListener(this)) { 380 observer_(new WorkerCreationDestructionListener(this)) {
380 web_ui->AddMessageHandler(new InspectMessageHandler()); 381 web_ui->AddMessageHandler(new InspectMessageHandler());
381 382
382 InspectDataSource* html_source = new InspectDataSource(); 383 InspectDataSource* html_source = new InspectDataSource();
383 384
384 Profile* profile = Profile::FromWebUI(web_ui); 385 Profile* profile = Profile::FromWebUI(web_ui);
385 profile->GetChromeURLDataManager()->AddDataSource(html_source); 386 ChromeURLDataManager::AddDataSource(profile, html_source);
386 387
387 registrar_.Add(this, 388 registrar_.Add(this,
388 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, 389 content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
389 content::NotificationService::AllSources()); 390 content::NotificationService::AllSources());
390 registrar_.Add(this, 391 registrar_.Add(this,
391 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, 392 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
392 content::NotificationService::AllSources()); 393 content::NotificationService::AllSources());
393 registrar_.Add(this, 394 registrar_.Add(this,
394 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 395 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
395 content::NotificationService::AllSources()); 396 content::NotificationService::AllSources());
396 } 397 }
397 398
398 InspectUI::~InspectUI() { 399 InspectUI::~InspectUI() {
399 observer_->InspectUIDestroyed(); 400 observer_->InspectUIDestroyed();
400 observer_ = NULL; 401 observer_ = NULL;
401 } 402 }
402 403
403 void InspectUI::RefreshUI() { 404 void InspectUI::RefreshUI() {
404 web_ui()->CallJavascriptFunction("populateLists"); 405 web_ui()->CallJavascriptFunction("populateLists");
405 } 406 }
406 407
407 void InspectUI::Observe(int type, 408 void InspectUI::Observe(int type,
408 const content::NotificationSource& source, 409 const content::NotificationSource& source,
409 const content::NotificationDetails& details) { 410 const content::NotificationDetails& details) {
410 RefreshUI(); 411 RefreshUI();
411 } 412 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/keyboard_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698