diff options
author | vkuzkokov <vkuzkokov@chromium.org> | 2014-12-03 04:20:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-03 12:21:09 +0000 |
commit | 0f1372f8bba274ada49d6cb859b21c9459e5199f (patch) | |
tree | 112c0e444b835ad198412af17ca1dd86d4ca7614 | |
parent | a12855418a74cf01d26d281231079a6ec5da710d (diff) | |
download | chromium_src-0f1372f8bba274ada49d6cb859b21c9459e5199f.zip chromium_src-0f1372f8bba274ada49d6cb859b21c9459e5199f.tar.gz chromium_src-0f1372f8bba274ada49d6cb859b21c9459e5199f.tar.bz2 |
[DevTools] Removed devtools_protocol_constants in content
BUG=405566
Review URL: https://codereview.chromium.org/737763003
Cr-Commit-Position: refs/heads/master@{#306591}
-rw-r--r-- | chrome/browser/devtools/BUILD.gn | 2 | ||||
-rw-r--r-- | chrome/browser/devtools/devtools_protocol_constants.gyp | 2 | ||||
-rwxr-xr-x | chrome/browser/devtools/devtools_protocol_constants_generator.py (renamed from content/public/browser/devtools_protocol_constants_generator.py) | 4 | ||||
-rw-r--r-- | content/browser/BUILD.gn | 2 | ||||
-rw-r--r-- | content/browser/devtools/BUILD.gn | 26 | ||||
-rw-r--r-- | content/browser/devtools/devtools_http_handler_impl.cc | 1 | ||||
-rw-r--r-- | content/browser/devtools/devtools_resources.gyp | 28 | ||||
-rwxr-xr-x | content/browser/devtools/protocol/devtools_protocol_handler_generator.py | 18 | ||||
-rw-r--r-- | content/content_browser.gypi | 3 |
9 files changed, 22 insertions, 64 deletions
diff --git a/chrome/browser/devtools/BUILD.gn b/chrome/browser/devtools/BUILD.gn index 0d2d4ab..ab9c946 100644 --- a/chrome/browser/devtools/BUILD.gn +++ b/chrome/browser/devtools/BUILD.gn @@ -3,7 +3,7 @@ # found in the LICENSE file. action("devtools_protocol_constants") { - script = "//content/public/browser/devtools_protocol_constants_generator.py" + script = "devtools_protocol_constants_generator.py" blink_protocol = "//third_party/WebKit/Source/devtools/protocol.json" browser_protocol = "//content/browser/devtools/browser_protocol.json" diff --git a/chrome/browser/devtools/devtools_protocol_constants.gyp b/chrome/browser/devtools/devtools_protocol_constants.gyp index 01031f4..edaa1f9 100644 --- a/chrome/browser/devtools/devtools_protocol_constants.gyp +++ b/chrome/browser/devtools/devtools_protocol_constants.gyp @@ -13,7 +13,7 @@ 'variables': { 'blink_protocol': '../../../third_party/WebKit/Source/devtools/protocol.json', 'browser_protocol': '../../../content/browser/devtools/browser_protocol.json', - 'generator': '../../../content/public/browser/devtools_protocol_constants_generator.py', + 'generator': 'devtools_protocol_constants_generator.py', 'package': 'chrome' }, 'inputs': [ diff --git a/content/public/browser/devtools_protocol_constants_generator.py b/chrome/browser/devtools/devtools_protocol_constants_generator.py index 3447fb1..372874d 100755 --- a/content/public/browser/devtools_protocol_constants_generator.py +++ b/chrome/browser/devtools/devtools_protocol_constants_generator.py @@ -23,7 +23,7 @@ template_h = string.Template("""\ // THIS FILE IS AUTOGENERATED. DO NOT EDIT. // Generated by -// content/public/browser/devtools_protocol_constants_generator.py from +// chrome/browser/devtools/devtools_protocol_constants_generator.py from // third_party/WebKit/Source/devtools/protocol.json and // content/browser/devtools/browser_protocol.json @@ -52,7 +52,7 @@ template_cc = string.Template("""\ // THIS FILE IS AUTOGENERATED. DO NOT EDIT. // Generated by -// content/public/browser/devtools_protocol_constants_generator.py from +// chrome/browser/devtools/devtools_protocol_constants_generator.py from // third_party/WebKit/Source/devtools/protocol.json and // content/browser/devtools/browser_protocol.json diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index ccccb62..feb93d76 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -83,8 +83,6 @@ source_set("browser") { "$root_gen_dir/webkit/grit/devtools_resources_map.h", "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h", "$root_gen_dir/ui/resources/grit/webui_resources_map.cc", - "$root_gen_dir/content/browser/devtools/devtools_protocol_constants.cc", - "$root_gen_dir/content/browser/devtools/devtools_protocol_constants.h", "$root_gen_dir/content/browser/devtools/protocol/devtools_protocol_handler_impl.cc", "$root_gen_dir/content/browser/devtools/protocol/devtools_protocol_handler_impl.h", ], ".") diff --git a/content/browser/devtools/BUILD.gn b/content/browser/devtools/BUILD.gn index 19a4003..9a8fa4f 100644 --- a/content/browser/devtools/BUILD.gn +++ b/content/browser/devtools/BUILD.gn @@ -8,7 +8,6 @@ import("//tools/grit/grit_rule.gni") group("resources") { deps = [ ":devtools_resources", - ":devtools_protocol_constants", ":devtools_protocol_handler", ] } @@ -37,26 +36,6 @@ grit("devtools_resources") { ] } -action("gen_devtools_protocol_constants") { - visibility = [ ":devtools_protocol_constants" ] - - script = "//content/public/browser/devtools_protocol_constants_generator.py" - - blink_protocol = "//third_party/WebKit/Source/devtools/protocol.json" - browser_protocol = "browser_protocol.json" - inputs = [ blink_protocol, browser_protocol ] - - outputs = [ - "$target_gen_dir/devtools_protocol_constants.cc", - "$target_gen_dir/devtools_protocol_constants.h", - ] - - args = [ "content" ] + rebase_path(outputs, root_build_dir) + [ - rebase_path(blink_protocol, root_build_dir), - rebase_path(browser_protocol, root_build_dir), - ] -} - action("gen_devtools_protocol_handler") { visibility = [ ":devtools_protocol_handler" ] @@ -76,11 +55,6 @@ action("gen_devtools_protocol_handler") { rebase_path(outputs, root_build_dir) } -source_set("devtools_protocol_constants") { - visibility = [ ":resources" ] - sources = get_target_outputs(":gen_devtools_protocol_constants") -} - source_set("devtools_protocol_handler") { visibility = [ ":resources" ] sources = get_target_outputs(":gen_devtools_protocol_handler") diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index f3aa4a3..3f3df91 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc @@ -17,7 +17,6 @@ #include "base/values.h" #include "content/browser/devtools/devtools_manager.h" #include "content/browser/devtools/devtools_protocol.h" -#include "content/browser/devtools/devtools_protocol_constants.h" #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" #include "content/browser/devtools/protocol/system_info_handler.h" #include "content/browser/devtools/protocol/tethering_handler.h" diff --git a/content/browser/devtools/devtools_resources.gyp b/content/browser/devtools/devtools_resources.gyp index 72ae706..3b82cc3 100644 --- a/content/browser/devtools/devtools_resources.gyp +++ b/content/browser/devtools/devtools_resources.gyp @@ -43,34 +43,6 @@ '<@(grit_rc_header_format)'], 'message': 'Generating resources from <(grit_grd_file)', }, - { - 'action_name': 'devtools_protocol_constants', - 'variables': { - 'blink_protocol': '../../../third_party/WebKit/Source/devtools/protocol.json', - 'browser_protocol': 'browser_protocol.json', - 'generator': '../../public/browser/devtools_protocol_constants_generator.py', - 'package': 'content' - }, - 'inputs': [ - '<(blink_protocol)', - '<(browser_protocol)', - '<(generator)', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/<(package)/browser/devtools/devtools_protocol_constants.cc', - '<(SHARED_INTERMEDIATE_DIR)/<(package)/browser/devtools/devtools_protocol_constants.h' - ], - 'action':[ - 'python', - '<(generator)', - '<(package)', - '<(SHARED_INTERMEDIATE_DIR)/<(package)/browser/devtools/devtools_protocol_constants.cc', - '<(SHARED_INTERMEDIATE_DIR)/<(package)/browser/devtools/devtools_protocol_constants.h', - '<(blink_protocol)', - '<(browser_protocol)', - ], - 'message': 'Generating DevTools protocol constants from <(blink_protocol)' - } ], 'direct_dependent_settings': { 'include_dirs': [ diff --git a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py index 9138e26..e35f2f9 100755 --- a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py +++ b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py @@ -38,6 +38,10 @@ class DevToolsProtocolHandlerImpl; namespace devtools { +extern const char kProtocolVersion[]; + +bool IsSupportedProtocolVersion(const std::string& version); + template<typename T> base::Value* CreateValue(const T& param) { return new base::FundamentalValue(param); @@ -227,6 +231,7 @@ template_cc = string.Template(header + """\ #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" #include "base/bind.h" +#include "base/strings/string_number_conversions.h" ${includes}\ namespace content { @@ -271,6 +276,17 @@ ${methods}\ namespace devtools { +const char kProtocolVersion[] = "${major}.${minor}"; + +bool IsSupportedProtocolVersion(const std::string& version) { + std::vector<std::string> tokens; + Tokenize(version, ".", &tokens); + int major, minor; + return tokens.size() == 2 && + base::StringToInt(tokens[0], &major) && major == ${major} && + base::StringToInt(tokens[1], &minor) && minor <= ${minor}; +} + template<> base::Value* CreateValue(const std::string& param) { return new base::StringValue(param); @@ -730,6 +746,8 @@ output_h_file.write(template_h.substitute({}, output_h_file.close() output_cc_file.write(template_cc.substitute({}, + major = blink_protocol["version"]["major"], + minor = blink_protocol["version"]["minor"], includes = "".join(sorted(includes)), fields_init = ",\n ".join(fields_init), methods = "\n".join(handler_method_impls), diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 819ce32..cf826c6 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -1421,9 +1421,6 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources_map.h', '<(SHARED_INTERMEDIATE_DIR)/content/browser/tracing/grit/tracing_resources.h', '<(SHARED_INTERMEDIATE_DIR)/ui/resources/grit/webui_resources_map.cc', - # These files are generated by devtools_protocol_constants_generator.py. - '<(SHARED_INTERMEDIATE_DIR)/content/browser/devtools/devtools_protocol_constants.cc', - '<(SHARED_INTERMEDIATE_DIR)/content/browser/devtools/devtools_protocol_constants.h', # These files are generated by devtools_protocol_handler_generator.py. '<(SHARED_INTERMEDIATE_DIR)/content/browser/devtools/protocol/devtools_protocol_handler_impl.cc', '<(SHARED_INTERMEDIATE_DIR)/content/browser/devtools/protocol/devtools_protocol_handler_impl.h', |