diff options
author | torne <torne@chromium.org> | 2014-11-04 08:30:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-04 16:32:03 +0000 |
commit | e72c9f4cc8e2d5abdf9ae4506abf94d5eb7a91d6 (patch) | |
tree | a3ab4051e0004b83a46232731aa0cd22be5a5426 | |
parent | 65ce5accb99908e292b9766c3da6cf54d6cc337f (diff) | |
download | chromium_src-e72c9f4cc8e2d5abdf9ae4506abf94d5eb7a91d6.zip chromium_src-e72c9f4cc8e2d5abdf9ae4506abf94d5eb7a91d6.tar.gz chromium_src-e72c9f4cc8e2d5abdf9ae4506abf94d5eb7a91d6.tar.bz2 |
android_webview: use chrome version information.
Replace the hardcoded version number used for the WebView's user agent
with the real version number of the corresponding Chrome build. This
uses the version information from src/chrome/VERSION; there is a pending
bug to move this out of chrome/ (http://crbug.com/345538) which will not
be impeded by this change as the location of the version info is
obtained from build/util/version.gypi.
BUG=297522
Review URL: https://codereview.chromium.org/695313002
Cr-Commit-Position: refs/heads/master@{#302614}
-rw-r--r-- | android_webview/android_webview.gyp | 42 | ||||
-rw-r--r-- | android_webview/common/aw_content_client.cc | 6 | ||||
-rw-r--r-- | android_webview/common/aw_version_info_values.h.version | 10 | ||||
-rw-r--r-- | build/util/version.gypi | 2 |
4 files changed, 56 insertions, 4 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index 4d7e251..f0a08af 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -52,6 +52,47 @@ ], }, { + 'target_name': 'android_webview_version', + 'type': 'none', + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + # Because generate_version generates a header, we must set the + # hard_dependency flag. + 'hard_dependency': 1, + 'actions': [ + { + 'action_name': 'generate_version', + 'includes': [ + '../build/util/version.gypi', + ], + 'variables': { + 'template_input_path': 'common/aw_version_info_values.h.version', + }, + 'inputs': [ + '<(version_py_path)', + '<(template_input_path)', + '<(version_path)', + '<(lastchange_path)', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/android_webview/common/aw_version_info_values.h', + ], + 'action': [ + 'python', + '<(version_py_path)', + '-f', '<(version_path)', + '-f', '<(lastchange_path)', + '<(template_input_path)', + '<@(_outputs)', + ], + 'message': 'Generating version information', + }, + ], + }, + { 'target_name': 'android_webview_common', 'type': 'static_library', 'dependencies': [ @@ -79,6 +120,7 @@ '../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs', '../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu', 'android_webview_pak', + 'android_webview_version', ], 'include_dirs': [ '..', diff --git a/android_webview/common/aw_content_client.cc b/android_webview/common/aw_content_client.cc index e20b7b4..b866bdf 100644 --- a/android_webview/common/aw_content_client.cc +++ b/android_webview/common/aw_content_client.cc @@ -4,6 +4,7 @@ #include "android_webview/common/aw_content_client.h" +#include "android_webview/common/aw_version_info_values.h" #include "base/basictypes.h" #include "base/command_line.h" #include "content/public/common/content_switches.h" @@ -15,10 +16,7 @@ namespace { std::string GetProduct() { - // "Chrome/XX.0.0.0" identifies that this WebView is derived from the - // corresponding Chromium version XX. - // TODO(torne): Use chrome/VERSION file. See http://crbug.com/297522 - return "Chrome/40.0.0.0"; + return "Chrome/" PRODUCT_VERSION; } } diff --git a/android_webview/common/aw_version_info_values.h.version b/android_webview/common/aw_version_info_values.h.version new file mode 100644 index 0000000..72faf97 --- /dev/null +++ b/android_webview/common/aw_version_info_values.h.version @@ -0,0 +1,10 @@ +// Copyright (c) 2014 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. + +#ifndef ANDROID_WEBVIEW_COMMON_AW_VERSION_INFO_VALUES_H_ +#define ANDROID_WEBVIEW_COMMON_AW_VERSION_INFO_VALUES_H_ + +#define PRODUCT_VERSION "@MAJOR@.@MINOR@.@BUILD@.@PATCH@" + +#endif // ANDROID_WEBVIEW_COMMON_AW_VERSION_INFO_VALUES_H_ diff --git a/build/util/version.gypi b/build/util/version.gypi index 9d295b5..b05b415 100644 --- a/build/util/version.gypi +++ b/build/util/version.gypi @@ -7,9 +7,11 @@ 'variables': { 'version_py_path': '<(DEPTH)/build/util/version.py', 'version_path': '<(DEPTH)/chrome/VERSION', + 'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE', }, 'version_py_path': '<(version_py_path)', 'version_path': '<(version_path)', + 'lastchange_path': '<(lastchange_path)', 'version_full': '<!(python <(version_py_path) -f <(version_path) -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")', 'version_libchrome_short': |