diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-26 21:42:33 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-26 21:42:33 +0000 |
commit | be3577e29de4b446955d006ebee30581720c579b (patch) | |
tree | ba52dcbf3749a8ce6de2fb931a76db1d2fc75e46 | |
parent | 070f7d88fb21caaa642430e347312f009b839635 (diff) | |
download | chromium_src-be3577e29de4b446955d006ebee30581720c579b.zip chromium_src-be3577e29de4b446955d006ebee30581720c579b.tar.gz chromium_src-be3577e29de4b446955d006ebee30581720c579b.tar.bz2 |
Eliminate browser-side dependency on WebDevToolsAgent.
R=pfeldman@chromium.org
Review URL: https://codereview.chromium.org/17933002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208795 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/debugger/debugger_api.cc | 7 | ||||
-rw-r--r-- | content/browser/devtools/devtools_http_handler_impl.cc | 19 | ||||
-rw-r--r-- | content/public/browser/devtools_http_handler.h | 4 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 7 |
5 files changed, 19 insertions, 27 deletions
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index 0909b3a..6ad5f83 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc @@ -33,6 +33,7 @@ #include "chrome/common/extensions/extension.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_client_host.h" +#include "content/public/browser/devtools_http_handler.h" #include "content/public/browser/devtools_manager.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" @@ -48,10 +49,10 @@ #include "extensions/common/error_utils.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "webkit/glue/webkit_glue.h" using content::DevToolsAgentHost; using content::DevToolsClientHost; +using content::DevToolsHttpHandler; using content::DevToolsManager; using content::RenderProcessHost; using content::RenderViewHost; @@ -636,8 +637,8 @@ bool DebuggerAttachFunction::RunImpl() { if (!InitAgentHost()) return false; - if (!webkit_glue::IsInspectorProtocolVersionSupported( - params->required_version)) { + if (!DevToolsHttpHandler::IsSupportedProtocolVersion( + params->required_version)) { error_ = ErrorUtils::FormatErrorMessage( keys::kProtocolVersionNotSupportedError, params->required_version); diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index 01c9fd6..cc07f0a 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc @@ -44,8 +44,6 @@ #include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h" #include "net/server/http_server_request_info.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/web/WebDevToolsAgent.h" #include "ui/base/layout.h" #include "webkit/common/user_agent/user_agent.h" #include "webkit/common/user_agent/user_agent_util.h" @@ -56,6 +54,8 @@ const int kBufferSize = 16 * 1024; namespace { +static const char* kProtocolVersion = "1.0"; + static const char* kDevToolsHandlerThreadName = "Chrome_DevToolsHandlerThread"; static const char* kThumbUrlPrefix = "/thumb/"; @@ -166,6 +166,12 @@ static bool TimeComparator(const PageInfo& info1, const PageInfo& info2) { } // namespace // static +bool DevToolsHttpHandler::IsSupportedProtocolVersion( + const std::string& version) { + return version == kProtocolVersion; +} + +// static int DevToolsHttpHandler::GetFrontendResourceId(const std::string& name) { for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { if (name == kDevtoolsResources[i].name) @@ -486,12 +492,9 @@ void DevToolsHttpHandlerImpl::OnJsonRequestUI( if (command == "version") { base::DictionaryValue version; - version.SetString("Protocol-Version", - WebKit::WebDevToolsAgent::inspectorProtocolVersion()); - version.SetString("WebKit-Version", - webkit_glue::GetWebKitVersion()); - version.SetString("Browser", - content::GetContentClient()->GetProduct()); + version.SetString("Protocol-Version", kProtocolVersion); + version.SetString("WebKit-Version", webkit_glue::GetWebKitVersion()); + version.SetString("Browser", content::GetContentClient()->GetProduct()); version.SetString("User-Agent", webkit_glue::GetUserAgent(GURL(kAboutBlankURL))); SendJson(connection_id, net::HTTP_OK, &version, std::string()); diff --git a/content/public/browser/devtools_http_handler.h b/content/public/browser/devtools_http_handler.h index d01e801..95cf407 100644 --- a/content/public/browser/devtools_http_handler.h +++ b/content/public/browser/devtools_http_handler.h @@ -39,6 +39,10 @@ class DevToolsHttpHandler { virtual DevToolsAgentHost* ForIdentifier(const std::string& identifier) = 0; }; + // Returns true if the given protocol version is supported. + CONTENT_EXPORT static bool IsSupportedProtocolVersion( + const std::string& version); + // Returns frontend resource id for the given resource |name|. CONTENT_EXPORT static int GetFrontendResourceId( const std::string& name); diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index b51bc64..e7d65a4 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -164,15 +164,6 @@ int GetGlyphPageCount() { return WebGlyphCache::pageCount(); } -std::string GetInspectorProtocolVersion() { - return WebDevToolsAgent::inspectorProtocolVersion().utf8(); -} - -bool IsInspectorProtocolVersionSupported(const std::string& version) { - return WebDevToolsAgent::supportsInspectorProtocolVersion( - WebString::fromUTF8(version)); -} - COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN); #if defined(OS_LINUX) || defined(OS_ANDROID) diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 405d3d0..505332c 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -70,13 +70,6 @@ WEBKIT_GLUE_EXPORT WebKit::WebCanvas* ToWebCanvas(SkCanvas*); // used to get memory usage statistics. WEBKIT_GLUE_EXPORT int GetGlyphPageCount(); -// Returns WebKit Web Inspector protocol version. -std::string GetInspectorProtocolVersion(); - -// Tells caller whether the given protocol version is supported by the. -WEBKIT_GLUE_EXPORT bool IsInspectorProtocolVersionSupported( - const std::string& version); - // Returns an estimate of the memory usage of the renderer process. Different // platforms implement this function differently, and count in different // allocations. Results are not comparable across platforms. The estimate is |