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
This commit is contained in:
Marshall Greenblatt 2013-11-08 16:27:22 +00:00
parent d2dfded03a
commit d789d84c30
13 changed files with 0 additions and 180 deletions

View File

@ -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.

View File

@ -313,17 +313,6 @@ class CefBrowserHost : public virtual CefBase {
/*--cef()--*/
virtual CefRefPtr<CefRequestContext> 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.

View File

@ -571,11 +571,6 @@ CefRefPtr<CefRequestContext> 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,

View File

@ -115,7 +115,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE;
virtual CefRefPtr<CefClient> GetClient() OVERRIDE;
virtual CefRefPtr<CefRequestContext> 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

View File

@ -144,27 +144,6 @@ scoped_ptr<content::DevToolsTarget> CefDevToolsDelegate::CreateNewTarget(
return scoped_ptr<content::DevToolsTarget>();
}
scoped_ptr<content::DevToolsTarget> CefDevToolsDelegate::CreateTargetForId(
const std::string& id) {
scoped_ptr<content::DevToolsTarget> target;
std::vector<content::RenderViewHost*> rvh_list =
content::DevToolsAgentHost::GetValidRenderViewHosts();
for (std::vector<content::RenderViewHost*>::iterator it = rvh_list.begin();
it != rvh_list.end(); ++it) {
scoped_refptr<content::DevToolsAgentHost> 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<content::RenderViewHost*> 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<content::DevToolsAgentHost> 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());
}

View File

@ -35,8 +35,6 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE;
virtual scoped_ptr<content::DevToolsTarget> CreateNewTarget(const GURL& url)
OVERRIDE;
virtual scoped_ptr<content::DevToolsTarget> CreateTargetForId(
const std::string& id) OVERRIDE;
virtual void EnumerateTargets(TargetCallback callback) OVERRIDE;
virtual scoped_ptr<net::StreamListenSocket> 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_;

View File

@ -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;

View File

@ -160,22 +160,6 @@ CefRefPtr<CefRequestContext> 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;

View File

@ -45,7 +45,6 @@ class CefBrowserHostCToCpp
virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE;
virtual CefRefPtr<CefClient> GetClient() OVERRIDE;
virtual CefRefPtr<CefRequestContext> 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,

View File

@ -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

View File

@ -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<DevToolsTarget> 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<DevToolsTarget> 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<DevToolsTarget> CreateTargetForId(
+ const std::string& id) = 0;
+
typedef std::vector<DevToolsTarget*> TargetList;
typedef base::Callback<void(const TargetList&)> TargetCallback;

View File

@ -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() {

View File

@ -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