| 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/devtools_ui.h" | 5 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/browser/net/chrome_url_request_context.h" | 11 #include "chrome/browser/net/chrome_url_request_context.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | |
| 17 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/devtools_client_host.h" | 17 #include "content/public/browser/devtools_client_host.h" |
| 18 #include "content/public/browser/web_contents.h" |
| 19 #include "grit/devtools_resources_map.h" | 19 #include "grit/devtools_resources_map.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 | 21 |
| 22 using content::BrowserThread; | 22 using content::BrowserThread; |
| 23 using content::WebContents; |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 std::string PathWithoutParams(const std::string& path) { | 27 std::string PathWithoutParams(const std::string& path) { |
| 27 return GURL(std::string("chrome-devtools://devtools/") + path) | 28 return GURL(std::string("chrome-devtools://devtools/") + path) |
| 28 .path().substr(1); | 29 .path().substr(1); |
| 29 } | 30 } |
| 30 | 31 |
| 31 } // namespace | 32 } // namespace |
| 32 | 33 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void DevToolsUI::RegisterDevToolsDataSource(Profile* profile) { | 93 void DevToolsUI::RegisterDevToolsDataSource(Profile* profile) { |
| 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 94 static bool registered = false; | 95 static bool registered = false; |
| 95 if (!registered) { | 96 if (!registered) { |
| 96 DevToolsDataSource* data_source = new DevToolsDataSource(); | 97 DevToolsDataSource* data_source = new DevToolsDataSource(); |
| 97 profile->GetChromeURLDataManager()->AddDataSource(data_source); | 98 profile->GetChromeURLDataManager()->AddDataSource(data_source); |
| 98 registered = true; | 99 registered = true; |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 DevToolsUI::DevToolsUI(TabContents* contents) : ChromeWebUI(contents) { | 103 DevToolsUI::DevToolsUI(WebContents* contents) : ChromeWebUI(contents) { |
| 103 DevToolsDataSource* data_source = new DevToolsDataSource(); | 104 DevToolsDataSource* data_source = new DevToolsDataSource(); |
| 104 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 105 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 105 profile->GetChromeURLDataManager()->AddDataSource(data_source); | 106 profile->GetChromeURLDataManager()->AddDataSource(data_source); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { | 109 void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { |
| 109 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); | 110 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); |
| 110 ChromeWebUI::RenderViewCreated(render_view_host); | 111 ChromeWebUI::RenderViewCreated(render_view_host); |
| 111 } | 112 } |
| OLD | NEW |