From d789d84c309f640e25ccadea261e190ab5df007c Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 8 Nov 2013 16:27:22 +0000 Subject: [PATCH] Remove CefBrowserHost::GetDevToolsURL(). It is now possible to use DevTools without remote debugging, and the ability to load a remote debugging URL without first loading the discovery page is no longer supported (issue #659). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1511 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- include/capi/cef_browser_capi.h | 12 ------ include/cef_browser.h | 11 ------ libcef/browser/browser_host_impl.cc | 16 -------- libcef/browser/browser_host_impl.h | 3 -- libcef/browser/devtools_delegate.cc | 47 ------------------------ libcef/browser/devtools_delegate.h | 5 --- libcef_dll/cpptoc/browser_host_cpptoc.cc | 17 --------- libcef_dll/ctocpp/browser_host_ctocpp.cc | 16 -------- libcef_dll/ctocpp/browser_host_ctocpp.h | 1 - patch/patch.cfg | 6 --- patch/patches/devtools_target.patch | 41 --------------------- tests/cefclient/cefclient.cpp | 4 -- tests/unittests/test_suite.cc | 1 - 13 files changed, 180 deletions(-) delete mode 100644 patch/patches/devtools_target.patch diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index 4eb433e41..46dcf57b8 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -270,18 +270,6 @@ typedef struct _cef_browser_host_t { struct _cef_request_context_t* (CEF_CALLBACK *get_request_context)( struct _cef_browser_host_t* self); - /// - // Returns the DevTools URL for this browser. If |http_scheme| is true (1) the - // returned URL will use the http scheme instead of the chrome-devtools - // scheme. Remote debugging can be enabled by specifying the "remote- - // debugging-port" command-line flag or by setting the - // CefSettings.remote_debugging_port value. If remote debugging is not enabled - // this function will return an NULL string. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_dev_tools_url)( - struct _cef_browser_host_t* self, int http_scheme); - /// // Get the current zoom level. The default zoom level is 0.0. This function // can only be called on the UI thread. diff --git a/include/cef_browser.h b/include/cef_browser.h index 4e2a9f380..e28c5d834 100644 --- a/include/cef_browser.h +++ b/include/cef_browser.h @@ -313,17 +313,6 @@ class CefBrowserHost : public virtual CefBase { /*--cef()--*/ virtual CefRefPtr GetRequestContext() =0; - /// - // Returns the DevTools URL for this browser. If |http_scheme| is true the - // returned URL will use the http scheme instead of the chrome-devtools - // scheme. Remote debugging can be enabled by specifying the - // "remote-debugging-port" command-line flag or by setting the - // CefSettings.remote_debugging_port value. If remote debugging is not enabled - // this method will return an empty string. - /// - /*--cef()--*/ - virtual CefString GetDevToolsURL(bool http_scheme) =0; - /// // Get the current zoom level. The default zoom level is 0.0. This method can // only be called on the UI thread. diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index f6d60d381..0f8d538e8 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -571,11 +571,6 @@ CefRefPtr CefBrowserHostImpl::GetRequestContext() { return request_context_; } -CefString CefBrowserHostImpl::GetDevToolsURL(bool http_scheme) { - base::AutoLock lock_scope(state_lock_); - return (http_scheme ? devtools_url_http_ : devtools_url_chrome_); -} - double CefBrowserHostImpl::GetZoomLevel() { // Verify that this method is being called on the UI thread. if (!CEF_CURRENTLY_ON_UIT()) { @@ -1938,17 +1933,6 @@ void CefBrowserHostImpl::RenderViewCreated( browser_info_->add_render_id(render_view_host->GetProcess()->GetID(), render_view_host->GetRoutingID()); - // Update the DevTools URLs, if any. - CefDevToolsDelegate* devtools_delegate = - CefContentBrowserClient::Get()->devtools_delegate(); - if (devtools_delegate) { - base::AutoLock lock_scope(state_lock_); - devtools_url_http_ = - devtools_delegate->GetDevToolsURL(render_view_host, true); - devtools_url_chrome_ = - devtools_delegate->GetDevToolsURL(render_view_host, false); - } - // May be already registered if the renderer crashed previously. if (!registrar_->IsRegistered( this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index ff2d80bbd..71b83e4bd 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -115,7 +115,6 @@ class CefBrowserHostImpl : public CefBrowserHost, virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE; virtual CefRefPtr GetClient() OVERRIDE; virtual CefRefPtr GetRequestContext() OVERRIDE; - virtual CefString GetDevToolsURL(bool http_scheme) OVERRIDE; virtual double GetZoomLevel() OVERRIDE; virtual void SetZoomLevel(double zoomLevel) OVERRIDE; virtual void RunFileDialog( @@ -519,8 +518,6 @@ class CefBrowserHostImpl : public CefBrowserHost, bool can_go_forward_; bool has_document_; GURL loading_url_; - CefString devtools_url_http_; - CefString devtools_url_chrome_; // Messages we queue while waiting for the RenderView to be ready. We queue // them here instead of in the RenderProcessHost to ensure that they're sent diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc index 944186300..f5ce913db 100644 --- a/libcef/browser/devtools_delegate.cc +++ b/libcef/browser/devtools_delegate.cc @@ -144,27 +144,6 @@ scoped_ptr CefDevToolsDelegate::CreateNewTarget( return scoped_ptr(); } -scoped_ptr CefDevToolsDelegate::CreateTargetForId( - const std::string& id) { - scoped_ptr target; - - std::vector rvh_list = - content::DevToolsAgentHost::GetValidRenderViewHosts(); - for (std::vector::iterator it = rvh_list.begin(); - it != rvh_list.end(); ++it) { - scoped_refptr agent_host( - content::DevToolsAgentHost::GetOrCreateFor(*it)); - if (agent_host->GetId() == id) { - content::WebContents* web_contents = - content::WebContents::FromRenderViewHost(*it); - target.reset(new Target(web_contents)); - break; - } - } - - return target.Pass(); -} - void CefDevToolsDelegate::EnumerateTargets(TargetCallback callback) { TargetList targets; std::vector rvh_list = @@ -190,29 +169,3 @@ std::string CefDevToolsDelegate::GetChromeDevToolsURL() { return base::StringPrintf("%s://%s/devtools.html", chrome::kChromeDevToolsScheme, scheme::kChromeDevToolsHost); } - -std::string CefDevToolsDelegate::GetDevToolsURL(content::RenderViewHost* rvh, - bool http_scheme) { - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - std::string port_str = - command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); - DCHECK(!port_str.empty()); - int port; - if (!base::StringToInt(port_str, &port)) - return std::string(); - - scoped_refptr agent_host( - content::DevToolsAgentHost::GetOrCreateFor(rvh)); - - const std::string& page_id = agent_host->GetId(); - const std::string& host = http_scheme ? - base::StringPrintf("http://localhost:%d/devtools/", port) : - base::StringPrintf("%s://%s/", chrome::kChromeDevToolsScheme, - scheme::kChromeDevToolsHost); - - return base::StringPrintf( - "%sdevtools.html?ws=localhost:%d/devtools/page/%s", - host.c_str(), - port, - page_id.c_str()); -} diff --git a/libcef/browser/devtools_delegate.h b/libcef/browser/devtools_delegate.h index bfedd8545..b4f731b86 100644 --- a/libcef/browser/devtools_delegate.h +++ b/libcef/browser/devtools_delegate.h @@ -35,8 +35,6 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE; virtual scoped_ptr CreateNewTarget(const GURL& url) OVERRIDE; - virtual scoped_ptr CreateTargetForId( - const std::string& id) OVERRIDE; virtual void EnumerateTargets(TargetCallback callback) OVERRIDE; virtual scoped_ptr CreateSocketForTethering( net::StreamListenSocket::Delegate* delegate, @@ -45,9 +43,6 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { // Returns the chrome-devtools URL. std::string GetChromeDevToolsURL(); - // Returns the DevTools URL for the specified RenderViewHost. - std::string GetDevToolsURL(content::RenderViewHost* rvh, bool http_scheme); - private: content::DevToolsHttpHandler* devtools_http_handler_; diff --git a/libcef_dll/cpptoc/browser_host_cpptoc.cc b/libcef_dll/cpptoc/browser_host_cpptoc.cc index d2d03d88c..59940b4da 100644 --- a/libcef_dll/cpptoc/browser_host_cpptoc.cc +++ b/libcef_dll/cpptoc/browser_host_cpptoc.cc @@ -213,22 +213,6 @@ struct _cef_request_context_t* CEF_CALLBACK browser_host_get_request_context( return CefRequestContextCppToC::Wrap(_retval); } -cef_string_userfree_t CEF_CALLBACK browser_host_get_dev_tools_url( - struct _cef_browser_host_t* self, int http_scheme) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefString _retval = CefBrowserHostCppToC::Get(self)->GetDevToolsURL( - http_scheme?true:false); - - // Return type: string - return _retval.DetachToUserFree(); -} - double CEF_CALLBACK browser_host_get_zoom_level( struct _cef_browser_host_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -676,7 +660,6 @@ CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls) browser_host_get_opener_window_handle; struct_.struct_.get_client = browser_host_get_client; struct_.struct_.get_request_context = browser_host_get_request_context; - struct_.struct_.get_dev_tools_url = browser_host_get_dev_tools_url; struct_.struct_.get_zoom_level = browser_host_get_zoom_level; struct_.struct_.set_zoom_level = browser_host_set_zoom_level; struct_.struct_.run_file_dialog = browser_host_run_file_dialog; diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.cc b/libcef_dll/ctocpp/browser_host_ctocpp.cc index 8ded3a83e..480f2ea3c 100644 --- a/libcef_dll/ctocpp/browser_host_ctocpp.cc +++ b/libcef_dll/ctocpp/browser_host_ctocpp.cc @@ -160,22 +160,6 @@ CefRefPtr CefBrowserHostCToCpp::GetRequestContext() { return CefRequestContextCToCpp::Wrap(_retval); } -CefString CefBrowserHostCToCpp::GetDevToolsURL(bool http_scheme) { - if (CEF_MEMBER_MISSING(struct_, get_dev_tools_url)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_dev_tools_url(struct_, - http_scheme); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - double CefBrowserHostCToCpp::GetZoomLevel() { if (CEF_MEMBER_MISSING(struct_, get_zoom_level)) return 0; diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.h b/libcef_dll/ctocpp/browser_host_ctocpp.h index 23dc9f217..fade08131 100644 --- a/libcef_dll/ctocpp/browser_host_ctocpp.h +++ b/libcef_dll/ctocpp/browser_host_ctocpp.h @@ -45,7 +45,6 @@ class CefBrowserHostCToCpp virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE; virtual CefRefPtr GetClient() OVERRIDE; virtual CefRefPtr GetRequestContext() OVERRIDE; - virtual CefString GetDevToolsURL(bool http_scheme) OVERRIDE; virtual double GetZoomLevel() OVERRIDE; virtual void SetZoomLevel(double zoomLevel) OVERRIDE; virtual void RunFileDialog(FileDialogMode mode, const CefString& title, diff --git a/patch/patch.cfg b/patch/patch.cfg index 3e54631ef..c00cd3f5e 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -52,12 +52,6 @@ patches = [ 'name': 'underlay_1051', 'path': '../ui/base/cocoa/', }, - { - # Support direct access to DevTools URLs. - # https://codereview.chromium.org/27600002/ - 'name': 'devtools_target', - 'path': '../content/', - }, { # Disable scollbar bounce and overlay on OS X. # http://code.google.com/p/chromiumembedded/issues/detail?id=364 diff --git a/patch/patches/devtools_target.patch b/patch/patches/devtools_target.patch deleted file mode 100644 index 5391df3ff..000000000 --- a/patch/patches/devtools_target.patch +++ /dev/null @@ -1,41 +0,0 @@ -Index: browser/devtools/devtools_http_handler_impl.cc -=================================================================== ---- browser/devtools/devtools_http_handler_impl.cc (revision 231322) -+++ browser/devtools/devtools_http_handler_impl.cc (working copy) -@@ -550,9 +550,16 @@ - - DevToolsTarget* DevToolsHttpHandlerImpl::GetTarget(const std::string& id) { - TargetMap::const_iterator it = target_map_.find(id); -- if (it == target_map_.end()) -+ if (it != target_map_.end()) -+ return it->second; -+ -+ scoped_ptr target(delegate_->CreateTargetForId(id)); -+ if (!target) - return NULL; -- return it->second; -+ -+ DCHECK_EQ(id, target->GetId()); -+ target_map_[id] = target.release(); -+ return target_map_[id]; - } - - void DevToolsHttpHandlerImpl::OnThumbnailRequestUI( -Index: public/browser/devtools_http_handler_delegate.h -=================================================================== ---- public/browser/devtools_http_handler_delegate.h (revision 231322) -+++ public/browser/devtools_http_handler_delegate.h (working copy) -@@ -39,6 +39,13 @@ - // Creates new inspectable target. - virtual scoped_ptr CreateNewTarget(const GURL& url) = 0; - -+ // Creates an inspectable target for the specified |id|. Called in cases where -+ // the target has not been enumerated (for example, direct URL access where -+ // the discovery JSON was not loaded first). This method was added for -+ // Chromium Embedded Framework. -+ virtual scoped_ptr CreateTargetForId( -+ const std::string& id) = 0; -+ - typedef std::vector TargetList; - typedef base::Callback TargetCallback; - diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp index abd33dc34..855a30d70 100644 --- a/tests/cefclient/cefclient.cpp +++ b/tests/cefclient/cefclient.cpp @@ -62,10 +62,6 @@ void AppGetSettings(CefSettings& settings) { CefString(&settings.cache_path) = g_command_line->GetSwitchValue(cefclient::kCachePath); - - // Specify a port to enable DevTools if one isn't already specified. - if (!g_command_line->HasSwitch("remote-debugging-port")) - settings.remote_debugging_port = 8088; } bool AppIsOffScreenRenderingEnabled() { diff --git a/tests/unittests/test_suite.cc b/tests/unittests/test_suite.cc index 1d9224e7b..6d4448c4f 100644 --- a/tests/unittests/test_suite.cc +++ b/tests/unittests/test_suite.cc @@ -61,7 +61,6 @@ void CefTestSuite::GetSettings(CefSettings& settings) { // Necessary for V8Test.OnUncaughtException tests. settings.uncaught_exception_stack_size = 10; - settings.remote_debugging_port = 12345; } // static