diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 15:37:57 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 15:37:57 +0000 |
commit | 499a71fa0fca0f7b4b8160906d64cf011561d516 (patch) | |
tree | 52f8a2924331669211c93947f60357d671ca9845 | |
parent | 8fbd2fd1de74271f77068bceb8deccc70aa4fe42 (diff) | |
download | chromium_src-499a71fa0fca0f7b4b8160906d64cf011561d516.zip chromium_src-499a71fa0fca0f7b4b8160906d64cf011561d516.tar.gz chromium_src-499a71fa0fca0f7b4b8160906d64cf011561d516.tar.bz2 |
DevTools: refactor remote debugging server to enable content_shell debugging.
BUG=97465
TEST=
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=119230
Review URL: https://chromiumcodereview.appspot.com/9113079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119243 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed, 195 insertions, 101 deletions
diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.cc b/chrome/browser/debugger/browser_list_tabcontents_provider.cc index ae02cd0..5461c44 100644 --- a/chrome/browser/debugger/browser_list_tabcontents_provider.cc +++ b/chrome/browser/debugger/browser_list_tabcontents_provider.cc @@ -8,7 +8,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "grit/devtools_frontend_resources.h" +#include "grit/devtools_discovery_page_resources.h" #include "net/url_request/url_request_context_getter.h" #include "ui/base/resource/resource_bundle.h" @@ -28,7 +28,7 @@ BrowserListTabContentsProvider::GetInspectableTabs() { std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { return ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_DEVTOOLS_FRONTEND_HTML).as_string(); + IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); } net::URLRequestContext* @@ -37,3 +37,13 @@ BrowserListTabContentsProvider::GetURLRequestContext() { Profile::Deprecated::GetDefaultRequestContext(); return getter ? getter->GetURLRequestContext() : NULL; } + +bool BrowserListTabContentsProvider::BundlesFrontendResources() { + // We'd like front-end to be served from the WebUI via proxy, hence + // pretend we don't have it bundled. + return false; +} + +std::string BrowserListTabContentsProvider::GetFrontendResourcesBaseURL() { + return "chrome-devtools://devtools/"; +} diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.h b/chrome/browser/debugger/browser_list_tabcontents_provider.h index 023db09..be40c5d 100644 --- a/chrome/browser/debugger/browser_list_tabcontents_provider.h +++ b/chrome/browser/debugger/browser_list_tabcontents_provider.h @@ -22,6 +22,8 @@ class BrowserListTabContentsProvider GetInspectableTabs() OVERRIDE; virtual std::string GetDiscoveryPageHTML() OVERRIDE; virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual bool BundlesFrontendResources() OVERRIDE; + virtual std::string GetFrontendResourcesBaseURL() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(BrowserListTabContentsProvider); diff --git a/chrome/browser/debugger/frontend/devtools_frontend.html b/chrome/browser/debugger/frontend/devtools_discovery_page.html index 85c03b8..85c03b8 100644 --- a/chrome/browser/debugger/frontend/devtools_frontend.html +++ b/chrome/browser/debugger/frontend/devtools_discovery_page.html diff --git a/chrome/browser/debugger/frontend/devtools_frontend_resources.grd b/chrome/browser/debugger/frontend/devtools_discovery_page_resources.grd index 0351cac..85ad2aa 100644 --- a/chrome/browser/debugger/frontend/devtools_frontend_resources.grd +++ b/chrome/browser/debugger/frontend/devtools_discovery_page_resources.grd @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <grit current_release="1" latest_public_release="0"> <outputs> - <output filename="grit/devtools_frontend_resources.h" + <output filename="grit/devtools_discovery_page_resources.h" type="rc_header"> <emit emit_type="prepend"/> </output> - <output filename="grit/devtools_frontend_resources_map.cc" + <output filename="grit/devtools_discovery_page_resources_map.cc" type="resource_file_map_source"/> - <output filename="grit/devtools_frontend_resources_map.h" + <output filename="grit/devtools_discovery_page_resources_map.h" type="resource_map_header"/> - <output filename="devtools_frontend_resources.pak" + <output filename="devtools_discovery_page_resources.pak" type="data_package"/> </outputs> <release seq="1"> <includes> - <include file="devtools_frontend.html" - name="IDR_DEVTOOLS_FRONTEND_HTML" + <include file="devtools_discovery_page.html" + name="IDR_DEVTOOLS_DISCOVERY_PAGE_HTML" type="BINDATA"/></includes> </release> </grit> diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index b07982b..abe7b73af 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -15,9 +15,9 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_client_host.h" +#include "content/public/browser/devtools_http_handler.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -#include "grit/devtools_resources_map.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -56,13 +56,9 @@ void DevToolsDataSource::StartDataRequest(const std::string& path, int request_id) { std::string filename = PathWithoutParams(path); - int resource_id = -1; - for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { - if (filename == kDevtoolsResources[i].name) { - resource_id = kDevtoolsResources[i].value; - break; - } - } + + int resource_id = + content::DevToolsHttpHandler::GetFrontendResourceId(filename); DLOG_IF(WARNING, -1 == resource_id) << "Unable to find dev tool resource: " << filename << ". If you compiled with debug_devtools=1, try running" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 23d6b3d..239f6ca 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -4184,8 +4184,7 @@ # These files are generated by GRIT. '<(grit_out_dir)/grit/component_extension_resources_map.cc', - '<(grit_out_dir)/grit/devtools_frontend_resources_map.cc', - '<(grit_out_dir)/grit/devtools_resources_map.cc', + '<(grit_out_dir)/grit/devtools_discovery_page_resources_map.cc', '<(grit_out_dir)/grit/shared_resources_map.cc', '<(grit_out_dir)/grit/theme_resources_map.cc', '<(grit_out_dir)/grit/theme_resources_standard_map.cc', diff --git a/chrome/chrome_repack_resources.gypi b/chrome/chrome_repack_resources.gypi index 0a0c1b2..2cde190 100644 --- a/chrome/chrome_repack_resources.gypi +++ b/chrome/chrome_repack_resources.gypi @@ -5,9 +5,9 @@ 'action_name': 'repack_resources', 'variables': { 'pak_inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak', '<(grit_out_dir)/component_extension_resources.pak', - '<(grit_out_dir)/devtools_frontend_resources.pak', - '<(grit_out_dir)/devtools_resources.pak', + '<(grit_out_dir)/devtools_discovery_page_resources.pak', '<(grit_out_dir)/net_internals_resources.pak', '<(grit_out_dir)/options_resources.pak', '<(grit_out_dir)/options2_resources.pak', diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index fc15532..be4fb16 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -11,7 +11,7 @@ 'target_name': 'chrome_extra_resources', 'type': 'none', 'dependencies': [ - '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:generate_devtools_grd', + '../content/browser/debugger/devtools_resources.gyp:devtools_resources', ], # These resources end up in resources.pak because they are resources # used by internal pages. Putting them in a spearate pak file makes @@ -74,39 +74,13 @@ 'includes': [ '../build/grit_action.gypi' ], }, { - 'action_name': 'devtools_frontend_resources', + 'action_name': 'devtools_discovery_page_resources', 'variables': { 'grit_grd_file': - 'browser/debugger/frontend/devtools_frontend_resources.grd', + 'browser/debugger/frontend/devtools_discovery_page_resources.grd', }, 'includes': [ '../build/grit_action.gypi' ] }, - { - 'action_name': 'devtools_resources', - # This can't use ../build/grit_action.gypi because the grd file - # is generated a build time, so the trick of using grit_info to get - # the real inputs/outputs at GYP time isn't possible. - 'variables': { - 'grit_cmd': ['python', '../tools/grit/grit.py'], - 'grit_grd_file': '<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd', - }, - 'inputs': [ - '<(grit_grd_file)', - '<!@pymod_do_main(grit_info --inputs)', - ], - 'outputs': [ - '<(grit_out_dir)/grit/devtools_resources.h', - '<(grit_out_dir)/devtools_resources.pak', - '<(grit_out_dir)/grit/devtools_resources_map.cc', - '<(grit_out_dir)/grit/devtools_resources_map.h', - ], - 'action': ['<@(grit_cmd)', - '-i', '<(grit_grd_file)', 'build', - '-o', '<(grit_out_dir)', - '-D', 'SHARED_INTERMEDIATE_DIR=<(SHARED_INTERMEDIATE_DIR)', - '<@(grit_defines)' ], - 'message': 'Generating resources from <(grit_grd_file)', - }, ], 'includes': [ '../build/grit_target.gypi' ], }, diff --git a/content/browser/debugger/DEPS b/content/browser/debugger/DEPS new file mode 100644 index 0000000..3e98aee --- /dev/null +++ b/content/browser/debugger/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + # Generated by the local devtools_resources.gyp:devtools_resources + "+grit/devtools_resources_map.h", +] diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc index 6d0bc99..349bacc 100644 --- a/content/browser/debugger/devtools_http_handler_impl.cc +++ b/content/browser/debugger/devtools_http_handler_impl.cc @@ -17,7 +17,6 @@ #include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/common/devtools_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_agent_host_registry.h" @@ -26,8 +25,11 @@ #include "content/public/browser/devtools_manager.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" +#include "content/public/common/content_client.h" #include "googleurl/src/gurl.h" +#include "grit/devtools_resources_map.h" #include "net/base/escape.h" #include "net/base/io_buffer.h" #include "net/server/http_server_request_info.h" @@ -80,57 +82,65 @@ class DevToolsClientHostImpl : public DevToolsClientHost { static int next_id = 1; -class TabContentsIDHelper : public content::WebContentsObserver { +class WebContentsIDHelper : public content::WebContentsObserver { public: - - static int GetID(TabContents* tab) { - TabContentsToIdMap::iterator it = tabcontents_to_id_.Get().find(tab); - if (it != tabcontents_to_id_.Get().end()) + static int GetID(WebContents* contents) { + WebContentsToIdMap::iterator it = web_contents_to_id_.Get().find(contents); + if (it != web_contents_to_id_.Get().end()) return it->second; - TabContentsIDHelper* wrapper = new TabContentsIDHelper(tab); + WebContentsIDHelper* wrapper = new WebContentsIDHelper(contents); return wrapper->id_; } - static TabContents* GetTabContents(int id) { - IdToTabContentsMap::iterator it = id_to_tabcontents_.Get().find(id); - if (it != id_to_tabcontents_.Get().end()) + static WebContents* GetWebContents(int id) { + IdToWebContentsMap::iterator it = id_to_web_contents_.Get().find(id); + if (it != id_to_web_contents_.Get().end()) return it->second; return NULL; } private: - explicit TabContentsIDHelper(TabContents* tab) + explicit WebContentsIDHelper(WebContents* tab) : content::WebContentsObserver(tab), id_(next_id++) { - id_to_tabcontents_.Get()[id_] = tab; - tabcontents_to_id_.Get()[tab] = id_; + id_to_web_contents_.Get()[id_] = tab; + web_contents_to_id_.Get()[tab] = id_; } - virtual ~TabContentsIDHelper() {} + virtual ~WebContentsIDHelper() {} - virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE { - id_to_tabcontents_.Get().erase(id_); - tabcontents_to_id_.Get().erase(static_cast<TabContents*>(tab)); + virtual void WebContentsDestroyed(WebContents* contents) OVERRIDE { + id_to_web_contents_.Get().erase(id_); + web_contents_to_id_.Get().erase(contents); delete this; } int id_; - typedef std::map<int, TabContents*> IdToTabContentsMap; - static base::LazyInstance<IdToTabContentsMap>::Leaky - id_to_tabcontents_; - typedef std::map<TabContents*, int> TabContentsToIdMap; - static base::LazyInstance<TabContentsToIdMap>::Leaky - tabcontents_to_id_; + typedef std::map<int, WebContents*> IdToWebContentsMap; + static base::LazyInstance<IdToWebContentsMap>::Leaky + id_to_web_contents_; + typedef std::map<WebContents*, int> WebContentsToIdMap; + static base::LazyInstance<WebContentsToIdMap>::Leaky + web_contents_to_id_; }; -base::LazyInstance<TabContentsIDHelper::IdToTabContentsMap>::Leaky - TabContentsIDHelper::id_to_tabcontents_ = LAZY_INSTANCE_INITIALIZER; -base::LazyInstance<TabContentsIDHelper::TabContentsToIdMap>::Leaky - TabContentsIDHelper::tabcontents_to_id_ = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<WebContentsIDHelper::IdToWebContentsMap>::Leaky + WebContentsIDHelper::id_to_web_contents_ = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<WebContentsIDHelper::WebContentsToIdMap>::Leaky + WebContentsIDHelper::web_contents_to_id_ = LAZY_INSTANCE_INITIALIZER; } // namespace // static +int DevToolsHttpHandler::GetFrontendResourceId(const std::string& name) { + for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { + if (name == kDevtoolsResources[i].name) + return kDevtoolsResources[i].value; + } + return -1; +} + +// static DevToolsHttpHandler* DevToolsHttpHandler::Start( const std::string& ip, int port, @@ -159,10 +169,33 @@ void DevToolsHttpHandlerImpl::Stop() { base::Bind(&DevToolsHttpHandlerImpl::TeardownAndRelease, this)); } +static std::string PathWithoutParams(const std::string& path) { + size_t query_position = path.find("?"); + if (query_position != std::string::npos) + return path.substr(0, query_position); + return path; +} + +static std::string GetMimeType(const std::string& filename) { + if (EndsWith(filename, ".html", false)) { + return "text/html"; + } else if (EndsWith(filename, ".css", false)) { + return "text/css"; + } else if (EndsWith(filename, ".js", false)) { + return "application/javascript"; + } else if (EndsWith(filename, ".png", false)) { + return "image/png"; + } else if (EndsWith(filename, ".gif", false)) { + return "image/gif"; + } + NOTREACHED(); + return "text/plain"; +} + void DevToolsHttpHandlerImpl::OnHttpRequest( int connection_id, const net::HttpServerRequestInfo& info) { - if (info.path == "/json") { + if (info.path.find("/json") == 0) { // Pages discovery json request. BrowserThread::PostTask( BrowserThread::UI, @@ -174,6 +207,12 @@ void DevToolsHttpHandlerImpl::OnHttpRequest( return; } + if (info.path == "" || info.path == "/") { + std::string response = delegate_->GetDiscoveryPageHTML(); + server_->Send200(connection_id, response, "text/html; charset=UTF-8"); + return; + } + // Proxy static files from chrome-devtools://devtools/*. net::URLRequestContext* request_context = delegate_->GetURLRequestContext(); if (!request_context) { @@ -181,16 +220,25 @@ void DevToolsHttpHandlerImpl::OnHttpRequest( return; } - if (info.path == "" || info.path == "/") { - std::string response = delegate_->GetDiscoveryPageHTML(); - server_->Send200(connection_id, response, "text/html; charset=UTF-8"); - return; - } - net::URLRequest* request; if (info.path.find("/devtools/") == 0) { - request = new net::URLRequest(GURL("chrome-devtools:/" + info.path), this); + // Serve front-end files from resource bundle. + std::string filename = PathWithoutParams(info.path.substr(10)); + + if (delegate_->BundlesFrontendResources()) { + int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename); + if (resource_id != -1) { + base::StringPiece data = + content::GetContentClient()->GetDataResource(resource_id); + server_->Send200(connection_id, + data.as_string(), + GetMimeType(filename)); + } + return; + } + std::string base_url = delegate_->GetFrontendResourcesBaseURL(); + request = new net::URLRequest(GURL(base_url + filename), this); } else if (info.path.find("/thumb/") == 0) { request = new net::URLRequest(GURL("chrome:/" + info.path), this); } else { @@ -293,8 +341,7 @@ static PageList GeneratePageList( DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> GetDevToolsClientHostFor(agent); PageInfo page_info; - page_info.id = TabContentsIDHelper::GetID( - static_cast<TabContents*>(web_contents)); + page_info.id = WebContentsIDHelper::GetID(web_contents); page_info.attached = client_host != NULL; page_info.url = entry->GetURL().spec(); page_info.title = UTF16ToUTF8(net::EscapeForHTML(entry->GetTitle())); @@ -359,15 +406,15 @@ void DevToolsHttpHandlerImpl::OnWebSocketRequestUI( return; } - TabContents* tab_contents = TabContentsIDHelper::GetTabContents(id); - if (tab_contents == NULL) { + WebContents* web_contents = WebContentsIDHelper::GetWebContents(id); + if (web_contents == NULL) { Send500(connection_id, "No such page id: " + page_id); return; } DevToolsManager* manager = DevToolsManager::GetInstance(); DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()); + web_contents->GetRenderViewHost()); if (manager->GetDevToolsClientHostFor(agent)) { Send500(connection_id, "Page with given id is being inspected: " + page_id); return; @@ -467,14 +514,15 @@ void DevToolsHttpHandlerImpl::OnReadCompleted(net::URLRequest* request, DevToolsHttpHandlerImpl::DevToolsHttpHandlerImpl( const std::string& ip, int port, - const std::string& frontend_host, + const std::string& frontend_url, DevToolsHttpHandlerDelegate* delegate) : ip_(ip), port_(port), - overridden_frontend_url_(frontend_host), + overridden_frontend_url_(frontend_url), delegate_(delegate) { if (overridden_frontend_url_.empty()) overridden_frontend_url_ = "/devtools/devtools.html"; + AddRef(); } @@ -538,7 +586,7 @@ void DevToolsHttpHandlerImpl::Send404(int connection_id) { } void DevToolsHttpHandlerImpl::Send500(int connection_id, - const std::string& message) { + const std::string& message) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&net::HttpServer::Send500, server_.get(), connection_id, diff --git a/content/browser/debugger/devtools_http_handler_impl.h b/content/browser/debugger/devtools_http_handler_impl.h index e9be675..556ab06d 100644 --- a/content/browser/debugger/devtools_http_handler_impl.h +++ b/content/browser/debugger/devtools_http_handler_impl.h @@ -18,8 +18,6 @@ #include "net/server/http_server.h" #include "net/url_request/url_request.h" -class TabContents; - namespace net { class URLRequestContext; } diff --git a/content/browser/debugger/devtools_netlog_observer.cc b/content/browser/debugger/devtools_netlog_observer.cc index 98492b2..a563a8d 100644 --- a/content/browser/debugger/devtools_netlog_observer.cc +++ b/content/browser/debugger/devtools_netlog_observer.cc @@ -240,17 +240,18 @@ void DevToolsNetLogObserver::OnAddSocketEntry( void DevToolsNetLogObserver::Attach() { DCHECK(!instance_); - - instance_ = new DevToolsNetLogObserver( - content::GetContentClient()->browser()->GetNetLog()); + net::NetLog* net_log = content::GetContentClient()->browser()->GetNetLog(); + if (net_log) + instance_ = new DevToolsNetLogObserver(net_log); } void DevToolsNetLogObserver::Detach() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(instance_); - delete instance_; - instance_ = NULL; + if (instance_) { + delete instance_; + instance_ = NULL; + } } DevToolsNetLogObserver* DevToolsNetLogObserver::GetInstance() { diff --git a/content/browser/debugger/devtools_resources.gyp b/content/browser/debugger/devtools_resources.gyp new file mode 100644 index 0000000..bacacac --- /dev/null +++ b/content/browser/debugger/devtools_resources.gyp @@ -0,0 +1,47 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'devtools_resources', + 'type': 'none', + 'dependencies': [ + '../../../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:generate_devtools_grd', + ], + 'variables': { + 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/webkit', + }, + 'actions': [ + { + 'action_name': 'devtools_resources', + # This can't use build/grit_action.gypi because the grd file + # is generated at build time, so the trick of using grit_info to get + # the real inputs/outputs at GYP time isn't possible. + 'variables': { + 'grit_cmd': ['python', '../../../tools/grit/grit.py'], + 'grit_grd_file': '<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd', + }, + 'inputs': [ + '<(grit_grd_file)', + '<!@pymod_do_main(grit_info --inputs)', + ], + 'outputs': [ + '<(grit_out_dir)/grit/devtools_resources.h', + '<(grit_out_dir)/devtools_resources.pak', + '<(grit_out_dir)/grit/devtools_resources_map.cc', + '<(grit_out_dir)/grit/devtools_resources_map.h', + ], + 'action': ['<@(grit_cmd)', + '-i', '<(grit_grd_file)', 'build', + '-o', '<(grit_out_dir)', + '-D', 'SHARED_INTERMEDIATE_DIR=<(SHARED_INTERMEDIATE_DIR)', + '<@(grit_defines)' ], + 'message': 'Generating resources from <(grit_grd_file)', + } + ], + 'includes': [ '../../../build/grit_target.gypi' ], + }, + ], +} diff --git a/content/content_browser.gypi b/content/content_browser.gypi index efbb363..0828aee 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -4,6 +4,7 @@ { 'dependencies': [ + 'browser/debugger/devtools_resources.gyp:devtools_resources', '../base/base.gyp:base_static', '../crypto/crypto.gyp:crypto', '../net/net.gyp:http_server', @@ -676,6 +677,9 @@ 'browser/zygote_host_linux.cc', 'browser/zygote_host_linux.h', 'browser/zygote_main_linux.cc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources.h', + '<(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources_map.cc', + '<(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources_map.h', ], 'conditions': [ ['OS!="win" and OS!="mac" and OS!="linux"', { diff --git a/content/public/browser/devtools_http_handler.h b/content/public/browser/devtools_http_handler.h index 58e7d9f..cd394f3 100644 --- a/content/public/browser/devtools_http_handler.h +++ b/content/public/browser/devtools_http_handler.h @@ -19,6 +19,10 @@ class DevToolsHttpHandlerDelegate; // this browser. class DevToolsHttpHandler { public: + // Returns frontend resource id for the given resource |name|. + CONTENT_EXPORT static int GetFrontendResourceId( + const std::string& name); + // Takes ownership over |delegate|. CONTENT_EXPORT static DevToolsHttpHandler* Start( const std::string& ip, diff --git a/content/public/browser/devtools_http_handler_delegate.h b/content/public/browser/devtools_http_handler_delegate.h index 4e09465..42f9e33 100644 --- a/content/public/browser/devtools_http_handler_delegate.h +++ b/content/public/browser/devtools_http_handler_delegate.h @@ -32,6 +32,13 @@ class DevToolsHttpHandlerDelegate { // Should return URL request context for issuing requests against devtools // webui or NULL if no context is available. Called on the IO thread. virtual net::URLRequestContext* GetURLRequestContext() = 0; + + // Returns true if and only if frontend resources are bundled. + virtual bool BundlesFrontendResources() = 0; + + // Returns URL that front-end files are available at, empty string if + // no internal server is available. + virtual std::string GetFrontendResourcesBaseURL() = 0; }; } // namespace content diff --git a/tools/gritsettings/resource_ids b/tools/gritsettings/resource_ids index 733038f..6685146 100644 --- a/tools/gritsettings/resource_ids +++ b/tools/gritsettings/resource_ids @@ -147,7 +147,7 @@ "includes": [21000], }, # This file is generated during the build. - "chrome/browser/debugger/frontend/devtools_frontend_resources.grd": { + "chrome/browser/debugger/frontend/devtools_discovery_page_resources.grd": { "includes": [21500], }, "chrome/browser/resources/options_resources.grd": { |