diff options
37 files changed, 38 insertions, 527 deletions
diff --git a/build/buildflag.h b/build/buildflag.h deleted file mode 100644 index 283f5bc..0000000 --- a/build/buildflag.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 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 BUILD_BUILDFLAG_H_ -#define BUILD_BUILDFLAG_H_ - -// These macros un-mangle the names of the build flags in a way that looks -// natural, and gives errors if the flag is not defined. Normally in the -// preprocessor it's easy to make mistakes that interpret "you haven't done -// the setup to know what the flag is" as "flag is off". Normally you would -// include the generated header rather than include this file directly. -// -// This is for use with generated headers. See build/build_header.gni. - -// This dance of two macros does a concatenation of two preprocessor args using -// ## doubly indirectly because using ## directly prevents macros in that -// parameter from being expanded. -#define BUILDFLAG_CAT_INDIRECT(a, b) a ## b -#define BUILDFLAG_CAT(a, b) BUILDFLAG_CAT_INDIRECT(a, b) - -// Accessor for build flags. -// -// To test for a value, if the build file specifies: -// -// ENABLE_FOO=true -// -// Then you would check at build-time in source code with: -// -// #include "foo_flags.h" // The header the build file specified. -// -// #if BUILDFLAG(ENABLE_FOO) -// ... -// #endif -// -// There will no #define called ENABLE_FOO so if you accidentally test for -// whether that is defined, it will always be negative. You can also use -// the value in expressions: -// -// const char kSpamServerName[] = BUILDFLAG(SPAM_SERVER_NAME); -// -// Because the flag is accessed as a preprocessor macro with (), an error -// will be thrown if the proper header defining the internal flag value has -// not been included. -#define BUILDFLAG(flag) (BUILDFLAG_CAT(BUILDFLAG_INTERNAL_, flag)()) - -#endif // BUILD_BUILDFLAG_H_ diff --git a/build/buildflag_header.gni b/build/buildflag_header.gni deleted file mode 100644 index 9054d07..0000000 --- a/build/buildflag_header.gni +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2015 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. - -# Generates a header with preprocessor defines specified by the build file. -# The GYP version of this (with instructions) is build/buildflag_header.gypi. -# -# The flags are converted to function-style defines with mangled names and -# code uses an accessor macro to access the values. This is to try to -# minimize bugs where code checks whether something is defined or not, and -# the proper header isn't included, meaning the answer will always be silently -# false or might vary across the code base. -# -# In the GN template, specify build flags in the template as a list -# of strings that encode key/value pairs like this: -# -# flags = [ "ENABLE_FOO=1", "ENABLE_BAR=$enable_bar" ] -# -# The GN values "true" and "false" will be mapped to 0 and 1 for boolean -# #if flags to be expressed naturally. This means you can't directly make a -# define that generates C++ value of true or false for use in code. If you -# REALLY need this, you can also use the string "(true)" and "(false)" to -# prevent the rewriting. - -# To check the value of the flag in C code: -# -# #include "path/to/here/header_file.h" -# -# #if BUILDFLAG(ENABLE_FOO) -# ... -# #endif -# -# const char kSpamServerUrl[] = BUILDFLAG(SPAM_SERVER_URL); -# -# There will no #define called ENABLE_FOO so if you accidentally test for that -# in an ifdef it will always be negative. -# -# -# Template parameters -# -# flags [required, list of strings] -# Flag values as described above. -# -# header [required, string] -# File name for generated header. By default, this will go in the -# generated file directory for this target, and you would include it -# with: -# #include "<path_to_this_BUILD_file>/<header>" -# -# header_dir [optional, string] -# Override the default location of the generated header. The string will -# be treated as a subdirectory of the root_gen_dir. For example: -# header_dir = "foo/bar" -# Then you can include the header as: -# #include "foo/bar/baz.h" -# -# deps, public_deps, testonly, visibility -# Normal meaning. -# -# -# Grit defines -# -# If one .grd file uses a flag, just add to the grit target: -# -# defines = [ -# "enable_doom_melon=$enable_doom_melon", -# ] -# -# If multiple .grd files use it, you'll want to put the defines in a .gni file -# so it can be shared. Generally this .gni file should include all grit defines -# for a given module (for some definition of "module"). Then do: -# -# defines = ui_grit_defines -# -# If you forget to do this, the flag will be implicitly false in the .grd file -# and those resources won't be compiled. You'll know because the resource -# #define won't be generated and any code that uses it won't compile. If you -# see a missing IDS_* string, this is probably the reason. -# -# -# Example -# -# buildflag_header("foo_features") { -# header = "foo_features.h" -# -# flags = [ -# # This uses the GN build flag enable_doom_melon as the definition. -# "ENABLE_DOOM_MELON=$enable_doom_melon", -# -# # This force-enables the flag. -# "ENABLE_SPACE_LASER=true", -# -# # This will expand to the quoted C string when used in source code. -# "SPAM_SERVER_URL=\"http://www.example.com/\"", -# ] -# } -template("buildflag_header") { - action(target_name) { - script = "//build/write_buildflag_header.py" - - if (defined(invoker.header_dir)) { - header_file = "${invoker.header_dir}/${invoker.header}" - } else { - # Compute the path from the root to this file. - header_file = rebase_path(".", "//") + "/${invoker.header}" - } - - outputs = [ - "$root_gen_dir/$header_file", - ] - - # Always write --flags to the file so it's not empty. Empty will confuse GN - # into thinking the response file isn't used. - response_file_contents = [ "--flags" ] - if (defined(invoker.flags)) { - response_file_contents += invoker.flags - } - - args = [ - "--output", - header_file, # Not rebased, Python script puts it inside gen-dir. - "--rulename", - get_label_info(":$target_name", "label_no_toolchain"), - "--gen-dir", - rebase_path(root_gen_dir, root_out_dir), - "--definitions", - "{{response_file_name}}", - ] - - forward_variables_from(invoker, - [ - "deps", - "public_deps", - "testonly", - "visibility", - ]) - } -} diff --git a/build/buildflag_header.gypi b/build/buildflag_header.gypi deleted file mode 100644 index 730ef429..0000000 --- a/build/buildflag_header.gypi +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright 2015 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. - -# Generates a header with preprocessor defines specified by the build file. -# -# The canonical documentation is in build/buildflag_header.gni. You should -# write the GN build, get it working, and then transform it into GYP. -# -# In every target that uses your generated header you must include a dependency -# on the GYP target that generates the header (this is implicit in GN). -# Otherwise, clean builds may not necessarily create the header before the -# source code is compiled. -# -# Assuming your GN code looks like this: -# -# buildflag_header("foo_features") { -# header = "foo_features.h" -# flags = [ -# "ENABLE_DOOM_MELON=$enable_doom_melon", -# "ENABLE_SPACE_LASER=true", -# "SPAM_SERVER_URL=\"http://www.example.com/\"", -# ] -# } -# -# Write a GYP target like this: -# -# { -# # GN version: //foo:foo_features -# 'target_name': 'foo_foo_features', -# 'includes': [ '../build/buildflag_header.gypi' ], -# 'variables': { -# 'buildflag_header_path': 'foo/foo_features.h', -# 'buildflag_header_flags': [ -# 'ENABLE_DOOM_MELON=<(enable_doom_melon)', -# 'ENABLE_SPACE_LASER=true', -# 'SPAM_SERVER_URL="http://www.example.com/"', -# ], -# }, -# } -# -# Variables -# -# target_name -# Base this on the GN label, replacing / and : with _ to make it globally -# unique. -# -# buildflag_header_path -# This must be the full path to the header from the source root. In GN -# you only say "features.h" and it uses the BUILD file's path implicitly. -# Use the path to BUILD.gn followed by your header name to produce the -# same output file. -# -# buildflag_flags (optional) -# List of the same format as GN's "flags". To expand variables, use -# "<(foo)" where GN would have used "$foo". -# -# includes -# List the relative path to build/buildflag_header.gypi from the .gyp -# file including this code, Note: If your code is in a .gypi file in a -# different directory, this must be relative to the .gyp including your -# file. -# -# -# Grit defines -# -# Follow the same advice as in the buildflag_header.gni, except on the grit -# action use the variable name 'grit_additional_defines' and explicitly add a -# '-D' in front: -# -# 'grit_grd_file': 'foo.grd', -# 'grit_additional_defines': [ -# '-D', 'enable_doom_melon=<(enable_doom_melon)', -# ], -# -# Put shared lists of defines in a .gypi. - -{ - 'type': 'none', - 'hard_dependency': 1, - - 'actions': [ - { - 'action_name': 'buildflag_header', - 'variables': { - # Default these values to empty if they're not defined. - 'variables': { - 'buildflag_flags%': [], - }, - - # Writes the flags to a response file with a name based on the name of - # this target. - 'response_file_name': '<|(<(_target_name)_buildflag_header.rsp --flags <@(buildflag_flags))', - - 'build_header_script': '<(DEPTH)/build/write_buildflag_header.py', - }, - - 'message': 'Generating build header.', - - 'inputs': [ - '<(build_header_script)', - '<(response_file_name)', - ], - - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/<(buildflag_header_path)', - ], - - 'action': [ - 'python', '<(build_header_script)', - '--output', '<(buildflag_header_path)', - '--rulename', '<(_target_name)', - '--gen-dir', '<(SHARED_INTERMEDIATE_DIR)', - '--definitions', '<(response_file_name)', - ], - } - ], -} diff --git a/build/common.gypi b/build/common.gypi index c5d5c85d..9c226a2 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -547,6 +547,9 @@ # Enable Chrome browser extensions 'enable_extensions%': 1, + # Enable Google Now. + 'enable_google_now%': 1, + # Enable basic printing support and UI. 'enable_basic_printing%': 1, @@ -816,6 +819,7 @@ ['OS=="android"', { 'enable_extensions%': 0, + 'enable_google_now%': 0, 'cld2_table_size%': 0, 'enable_themes%': 0, 'remoting%': 0, @@ -863,6 +867,7 @@ 'configuration_policy%': 0, 'disable_ftp_support%': 1, 'enable_extensions%': 0, + 'enable_google_now%': 0, 'cld2_table_size%': 0, 'enable_basic_printing%': 0, 'enable_print_preview%': 0, @@ -1216,6 +1221,7 @@ 'enable_print_preview%': '<(enable_print_preview)', 'enable_spellcheck%': '<(enable_spellcheck)', 'use_browser_spellchecker%': '<(use_browser_spellchecker)', + 'enable_google_now%': '<(enable_google_now)', 'cld_version%': '<(cld_version)', 'cld2_table_size%': '<(cld2_table_size)', 'enable_captive_portal_detection%': '<(enable_captive_portal_detection)', @@ -2174,6 +2180,9 @@ ['enable_settings_app==1', { 'grit_defines': ['-D', 'enable_settings_app'], }], + ['enable_google_now==1', { + 'grit_defines': ['-D', 'enable_google_now'], + }], ['use_concatenated_impulse_responses==1', { 'grit_defines': ['-D', 'use_concatenated_impulse_responses'], }], @@ -2986,6 +2995,9 @@ ['enable_background==1', { 'defines': ['ENABLE_BACKGROUND=1'], }], + ['enable_google_now==1', { + 'defines': ['ENABLE_GOOGLE_NOW=1'], + }], ['enable_basic_printing==1 or enable_print_preview==1', { # Convenience define for ENABLE_BASIC_PRINTING || ENABLE_PRINT_PREVIEW. 'defines': ['ENABLE_PRINTING=1'], diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 5f85713..9cc3756 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -218,6 +218,9 @@ config("feature_flags") { if (enable_image_loader_extension) { defines += [ "IMAGE_LOADER_EXTENSION=1" ] } + if (enable_google_now) { + defines += [ "ENABLE_GOOGLE_NOW=1" ] + } if (enable_one_click_signin) { defines += [ "ENABLE_ONE_CLICK_SIGNIN" ] } diff --git a/build/config/features.gni b/build/config/features.gni index 1d5f305..514a667 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -83,6 +83,8 @@ declare_args() { enable_autofill_dialog = !is_ios + enable_google_now = !is_ios && !is_android + enable_one_click_signin = is_win || is_mac || (is_linux && !is_chromeos) enable_remoting = !is_ios && !is_chromecast && !is_headless diff --git a/build/gypi_to_gn.py b/build/gypi_to_gn.py index 6de1a63..a107f94 100644 --- a/build/gypi_to_gn.py +++ b/build/gypi_to_gn.py @@ -96,12 +96,10 @@ def LoadPythonDictionary(path): if 'target_conditions' in file_data: del file_data['target_conditions'] - # Strip targets and includes in the toplevel, since some files define these - # and we can't slurp them in. + # Strip targets in the toplevel, since some files define these and we can't + # slurp them in. if 'targets' in file_data: del file_data['targets'] - if 'includes' in file_data: - del file_data['includes'] return file_data diff --git a/build/write_buildflag_header.py b/build/write_buildflag_header.py deleted file mode 100755 index d46cfc8..0000000 --- a/build/write_buildflag_header.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015 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. - -# This writes headers for build flags. See buildflag_header.gni for usage of -# this system as a whole. -# -# The parameters are passed in a response file so we don't have to worry -# about command line lengths. The name of the response file is passed on the -# command line. -# -# The format of the response file is: -# [--flags <list of one or more flag values>] - -import optparse -import os -import shlex -import sys - - -class Options: - def __init__(self, output, rulename, header_guard, flags): - self.output = output - self.rulename = rulename - self.header_guard = header_guard - self.flags = flags - - -def GetOptions(): - parser = optparse.OptionParser() - parser.add_option('--output', help="Output header name inside --gen-dir.") - parser.add_option('--rulename', - help="Helpful name of build rule for including in the " + - "comment at the top of the file.") - parser.add_option('--gen-dir', - help="Path to root of generated file directory tree.") - parser.add_option('--definitions', - help="Name of the response file containing the flags.") - cmdline_options, cmdline_flags = parser.parse_args() - - # Compute header guard by replacing some chars with _ and upper-casing. - header_guard = cmdline_options.output.upper() - header_guard = \ - header_guard.replace('/', '_').replace('\\', '_').replace('.', '_') - header_guard += '_' - - # The actual output file is inside the gen dir. - output = os.path.join(cmdline_options.gen_dir, cmdline_options.output) - - # Definition file in GYP is newline separated, in GN they are shell formatted. - # shlex can parse both of these. - with open(cmdline_options.definitions, 'r') as def_file: - defs = shlex.split(def_file.read()) - flags_index = defs.index('--flags') - - # Everything after --flags are flags. true/false are remapped to 1/0, - # everything else is passed through. - flags = [] - for flag in defs[flags_index + 1 :]: - equals_index = flag.index('=') - key = flag[:equals_index] - value = flag[equals_index + 1:] - - # Canonicalize and validate the value. - if value == 'true': - value = '1' - elif value == 'false': - value = '0' - flags.append((key, str(value))) - - return Options(output=output, - rulename=cmdline_options.rulename, - header_guard=header_guard, - flags=flags) - - -def WriteHeader(options): - with open(options.output, 'w') as output_file: - output_file.write("// Generated by build/write_buildflag_header.py\n") - if options.rulename: - output_file.write('// From "' + options.rulename + '"\n') - - output_file.write('\n#ifndef %s\n' % options.header_guard) - output_file.write('#define %s\n\n' % options.header_guard) - output_file.write('#include "build/buildflag.h"\n\n') - - for pair in options.flags: - output_file.write('#define BUILDFLAG_INTERNAL_%s() (%s)\n' % pair) - - output_file.write('\n#endif // %s\n' % options.header_guard) - - -options = GetOptions() -WriteHeader(options) diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 5ac3616..201589e 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -6,7 +6,6 @@ import("//build/config/chrome_build.gni") import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") -import("//chrome/common/features.gni") import("//media/media_options.gni") import("//third_party/protobuf/proto_library.gni") @@ -958,7 +957,6 @@ if (is_win) { # (generate_browser_resources action) grit("resources") { source = "browser_resources.grd" - defines = chrome_grit_defines output_dir = "$root_gen_dir/chrome" outputs = [ "grit/browser_resources.h", diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 56a5178..1e4a738 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -27,7 +27,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/features.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/crx_file/id_util.h" @@ -383,7 +382,7 @@ void ComponentLoader::AddNetworkSpeechSynthesisExtension() { } void ComponentLoader::AddGoogleNowExtension() { -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) const char kEnablePrefix[] = "Enable"; const char kFieldTrialName[] = "GoogleNow"; std::string enable_prefix(kEnablePrefix); @@ -419,7 +418,7 @@ void ComponentLoader::AddGoogleNowExtension() { } else { DeleteData(google_now_manifest_id, root_directory); } -#endif // BUILDFLAG(ENABLE_GOOGLE_NOW) +#endif // defined(ENABLE_GOOGLE_NOW) } #if defined(OS_CHROMEOS) diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 8566442..04d5e9f 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -12,7 +12,6 @@ #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/profile_sync_service_factory.h" -#include "chrome/common/features.h" #include "chrome/common/pref_names.h" #include "components/browser_sync/browser/profile_sync_service.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" @@ -99,7 +98,7 @@ void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDictionaryPref(prefs::kSafeBrowsingIncidentsSent); registry->RegisterBooleanPref( prefs::kSafeBrowsingExtendedReportingOptInAllowed, true); -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) registry->RegisterBooleanPref(prefs::kGoogleGeolocationAccessEnabled, false); #endif // This pref is intentionally outside the above #if. That flag corresponds diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn index 14de709..a5949a2 100644 --- a/chrome/browser/resources/BUILD.gn +++ b/chrome/browser/resources/BUILD.gn @@ -2,12 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//chrome/common/features.gni") import("//tools/grit/grit_rule.gni") grit("memory_internals_resources") { source = "memory_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/memory_internals_resources.h", "memory_internals_resources.pak", @@ -17,7 +15,6 @@ grit("memory_internals_resources") { grit("net_internals_resources") { source = "net_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/net_internals_resources.h", "net_internals_resources.pak", @@ -27,7 +24,6 @@ grit("net_internals_resources") { grit("invalidations_resources") { source = "invalidations_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/invalidations_resources.h", "invalidations_resources.pak", @@ -37,7 +33,6 @@ grit("invalidations_resources") { grit("password_manager_internals_resources") { source = "password_manager_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/password_manager_internals_resources.h", "password_manager_internals_resources.pak", @@ -47,7 +42,6 @@ grit("password_manager_internals_resources") { grit("signin_internals_resources") { source = "signin_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/signin_internals_resources.h", "signin_internals_resources.pak", @@ -57,7 +51,6 @@ grit("signin_internals_resources") { grit("translate_internals_resources") { source = "translate_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/translate_internals_resources.h", "translate_internals_resources.pak", @@ -78,7 +71,6 @@ copy("extension_resource_demo") { if (!is_ios) { grit("component_extension_resources") { source = "component_extension_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/component_extension_resources.h", "grit/component_extension_resources_map.cc", @@ -90,7 +82,6 @@ if (!is_ios) { grit("settings_resources") { source = "settings/settings_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/settings_resources.h", "grit/settings_resources_map.cc", @@ -102,7 +93,6 @@ if (!is_ios) { grit("options_resources") { source = "options_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/options_resources.h", "options_resources.pak", @@ -112,7 +102,6 @@ if (!is_ios) { grit("options_test_resources") { source = "options_test_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/options_test_resources.h", "options_test_resources.pak", @@ -122,7 +111,6 @@ if (!is_ios) { grit("quota_internals_resources") { source = "quota_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/quota_internals_resources.h", "quota_internals_resources.pak", @@ -132,7 +120,6 @@ if (!is_ios) { grit("sync_file_system_internals_resources") { source = "sync_file_system_internals_resources.grd" - defines = chrome_grit_defines outputs = [ "grit/sync_file_system_internals_resources.h", "sync_file_system_internals_resources.pak", diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index e8124cc..be6d20f 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -5,7 +5,6 @@ import("//build/config/crypto.gni") import("//build/config/features.gni") import("//build/config/ui.gni") -import("//chrome/common/features.gni") gypi_values = exec_script("//build/gypi_to_gn.py", [ rebase_path("../../chrome_browser_ui.gypi") ], diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 787a884..10ce23a 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -29,7 +29,6 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" -#include "chrome/common/features.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" @@ -452,7 +451,7 @@ void ContentSettingsHandler::GetLocalizedValues( {"cookiesShowCookies", IDS_COOKIES_SHOW_COOKIES_BUTTON}, {"flashStorageSettings", IDS_FLASH_STORAGE_SETTINGS}, {"flashStorageUrl", IDS_FLASH_STORAGE_URL}, -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) {"googleGeolocationAccessEnable", IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX}, #endif diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc index 56e784c..e69c199 100644 --- a/chrome/browser/ui/webui/options/options_ui.cc +++ b/chrome/browser/ui/webui/options/options_ui.cc @@ -47,7 +47,6 @@ #include "chrome/browser/ui/webui/options/startup_pages_handler.h" #include "chrome/browser/ui/webui/options/sync_setup_handler.h" #include "chrome/browser/ui/webui/theme_source.h" -#include "chrome/common/features.h" #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/locale_settings.h" @@ -101,7 +100,7 @@ #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" #endif -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) #include "chrome/browser/ui/webui/options/geolocation_options_handler.h" #endif @@ -280,7 +279,7 @@ OptionsUI::OptionsUI(content::WebUI* web_ui) AddOptionsPageUIHandler(localized_strings, new CreateProfileHandler()); AddOptionsPageUIHandler(localized_strings, new EasyUnlockHandler()); AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler()); -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) AddOptionsPageUIHandler(localized_strings, new GeolocationOptionsHandler()); #endif AddOptionsPageUIHandler(localized_strings, new options::HelpOverlayHandler()); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 9495002..cfd46cc 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -104,7 +104,6 @@ 'chrome_browser_ui.gypi', 'chrome_common.gypi', 'chrome_installer_util.gypi', - 'chrome_features.gypi', ], 'conditions': [ ['OS!="ios"', { diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi index e84068c..9c8b394 100644 --- a/chrome/chrome_android.gypi +++ b/chrome/chrome_android.gypi @@ -14,7 +14,6 @@ 'chrome.gyp:browser', 'chrome.gyp:browser_ui', 'chrome.gyp:child', - 'chrome.gyp:chrome_common_features', 'chrome.gyp:plugin', 'chrome.gyp:renderer', 'chrome.gyp:utility', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index f043321..748464d 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3064,7 +3064,6 @@ # NOTE: New dependencies should generally be added in the OS!="ios" # dependencies block below, rather than here. 'browser_ui', - 'chrome_common_features', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 7b23685..8c0ca4f 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -956,7 +956,6 @@ # browser, then we can clean up these dependencies. 'dependencies': [ 'browser/extensions/api/api_registration.gyp:chrome_api_registration', - 'chrome_common_features', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', diff --git a/chrome/chrome_child.gypi b/chrome/chrome_child.gypi index 95298fa..6464a39 100644 --- a/chrome/chrome_child.gypi +++ b/chrome/chrome_child.gypi @@ -9,7 +9,6 @@ 'type': 'static_library', 'variables': { 'enable_wexit_time_destructors': 1, }, 'dependencies': [ - 'chrome_common_features', '../base/base.gyp:base', '../content/content.gyp:content_child', ], diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index babce65..1438853 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -297,7 +297,6 @@ # GN: //chrome/common:common 'target_name': 'common', 'type': 'static_library', - 'hard_dependency': 1, # Because of transitive dep on version_header. 'variables': { 'chrome_common_target': 1, 'enable_wexit_time_destructors': 1, @@ -315,7 +314,6 @@ # TODO(gregoryd): chrome_resources and chrome_strings could be # shared with the 64-bit target, but it does not work due to a gyp # issue. - 'chrome_common_features', 'installer_util', 'safe_browsing_proto', '<(DEPTH)/base/base.gyp:base', @@ -566,7 +564,6 @@ 'common/net/x509_certificate_model_openssl.cc', ], 'dependencies': [ - 'chrome_common_features', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', @@ -656,16 +653,5 @@ '../third_party/mojo/mojo_public.gyp:mojo_cpp_bindings', ], }, - { - # GN version: //chrome/common:features - 'target_name': 'chrome_common_features', - 'includes': [ '../build/buildflag_header.gypi' ], - 'variables': { - 'buildflag_header_path': 'chrome/common/features.h', - 'buildflag_flags': [ - 'ENABLE_GOOGLE_NOW=<(enable_google_now)', - ], - }, - }, ], } diff --git a/chrome/chrome_debugger.gypi b/chrome/chrome_debugger.gypi index dae7b73..31991c6 100644 --- a/chrome/chrome_debugger.gypi +++ b/chrome/chrome_debugger.gypi @@ -13,7 +13,6 @@ '../base/base.gyp:base', '../content/content.gyp:content_browser', '../net/net.gyp:net', - 'chrome_common_features', 'browser/devtools/webrtc_device_provider_resources.gyp:webrtc_device_provider_resources', 'browser/devtools/devtools_protocol_constants.gyp:devtools_protocol_constants', ], diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index 1fd5b77..e0fef9e 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -46,10 +46,7 @@ # GN version: //chrome:chrome_initial 'target_name': 'chrome_initial', 'type': 'executable', - 'dependencies' : [ - '../chrome/common_constants.gyp:version_header', - 'chrome_common_features', - ], + 'dependencies' : [ '../chrome/common_constants.gyp:version_header', ], # Name the exe chrome.exe, not chrome_initial.exe. 'product_name': 'chrome', 'mac_bundle': 1, diff --git a/chrome/chrome_features.gypi b/chrome/chrome_features.gypi deleted file mode 100644 index a4d8756..0000000 --- a/chrome/chrome_features.gypi +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2015 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. - -# This is the GYP equivalent of //chrome/common/features.gni. -# Please keep in sync! - -{ - 'variables': { - 'variables': { - # Conditional variables. - 'conditions': [ - ['OS=="android" or OS=="ios"', { - 'enable_google_now%': 0, - }, { - 'enable_google_now%': 1, - }] - ], - }, - - # Anything in the conditions needs to be copied to the outer scope to be - # accessible. - 'enable_google_now%': '<(enable_google_now)', - - # Grit defines based on the feature flags. These must be manually added to - # grit targets. - 'chrome_grit_defines': [ - '-D', 'enable_google_now=<(enable_google_now)', - ] - }, -} diff --git a/chrome/chrome_plugin.gypi b/chrome/chrome_plugin.gypi index 418725b..718666c 100644 --- a/chrome/chrome_plugin.gypi +++ b/chrome/chrome_plugin.gypi @@ -9,7 +9,6 @@ 'type': 'static_library', 'variables': { 'enable_wexit_time_destructors': 1, }, 'dependencies': [ - 'chrome_common_features', '../base/base.gyp:base', '../content/content.gyp:content_plugin', '../gin/gin.gyp:gin', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index b8b978b..b12ac52 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -237,7 +237,6 @@ 'type': 'static_library', 'variables': { 'enable_wexit_time_destructors': 1, }, 'dependencies': [ - 'chrome_common_features', 'common', 'common_mojo_bindings', 'chrome_resources.gyp:chrome_resources', diff --git a/chrome/chrome_resources.gyp b/chrome/chrome_resources.gyp index 85116d4..6edb819 100644 --- a/chrome/chrome_resources.gyp +++ b/chrome/chrome_resources.gyp @@ -2,14 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { - 'includes': [ - 'chrome_features.gypi', - ], 'variables': { - # Apply Chrome-specific grit settings to all grit actions in this file. 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', - 'grit_additional_defines': [ '<@(chrome_grit_defines)' ], - 'additional_modules_list_file': '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/internal/additional_modules_list.txt', }, 'targets': [ diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 5b6e6a9..f3a92fd9 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1617,7 +1617,6 @@ 'type': 'executable', 'dependencies': [ 'browser', - 'chrome_common_features', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', 'chrome_resources.gyp:packed_extra_resources', @@ -2112,7 +2111,6 @@ 'type': 'executable', 'dependencies': [ 'browser', - 'chrome_common_features', 'chrome_resources.gyp:browser_tests_pak', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', @@ -2657,7 +2655,6 @@ 'type': 'executable', 'dependencies': [ 'browser', - 'chrome_common_features', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', 'chrome_resources.gyp:packed_extra_resources', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index ab44161..b9a6fd7 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1658,7 +1658,6 @@ # NOTE: New dependencies should generally be added in the OS!="ios" # dependencies block below, rather than here. 'browser', - 'chrome_common_features', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', 'chrome_resources.gyp:theme_resources', @@ -2213,7 +2212,6 @@ '../ui/base/ui_base.gyp:ui_base_test_support', '../ui/gfx/gfx.gyp:gfx_test_support', '../ui/resources/ui_resources.gyp:ui_resources', - 'chrome_common_features', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', ], diff --git a/chrome/chrome_utility.gypi b/chrome/chrome_utility.gypi index 638ba4e..d70f335 100644 --- a/chrome/chrome_utility.gypi +++ b/chrome/chrome_utility.gypi @@ -126,7 +126,6 @@ '../third_party/libxml/libxml.gyp:libxml', '<(DEPTH)/chrome/chrome_resources.gyp:chrome_resources', '<(DEPTH)/chrome/chrome_resources.gyp:chrome_strings', - 'chrome_common_features', 'common', ], 'include_dirs': [ diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 9b20bda..bc89196 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/buildflag_header.gni") -import("//chrome/common/features.gni") import("//chrome/version.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//tools/grit/grit_rule.gni") @@ -38,11 +36,6 @@ if (enable_extensions) { } } -buildflag_header("features") { - header = "features.h" - flags = [ "ENABLE_GOOGLE_NOW=$enable_google_now" ] -} - # GYP version: chrome/chrome_common.gypi:common static_library("common") { sources = rebase_path(gypi_values.chrome_common_sources, ".", "//chrome") @@ -54,7 +47,6 @@ static_library("common") { ] public_deps = [ - ":features", "//base:base", "//base:base_static", "//base:i18n", @@ -323,7 +315,6 @@ static_library("constants") { "//content/public/common:result_codes", ] deps = [ - ":features", ":version_header", "//base", "//base/third_party/dynamic_annotations", diff --git a/chrome/common/features.gni b/chrome/common/features.gni deleted file mode 100644 index 2e92745c..0000000 --- a/chrome/common/features.gni +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2015 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. - -# This is the GN version of //chrome/chrome_features.gypi. -# Please keep in sync! - -declare_args() { - enable_google_now = !is_ios && !is_android -} - -chrome_grit_defines = [ "enable_google_now=$enable_google_now" ] diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index d546cb0..f3bfd8e 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -5,7 +5,6 @@ #include "chrome/common/pref_names.h" #include "base/basictypes.h" -#include "chrome/common/features.h" #include "chrome/common/pref_font_webkit_names.h" namespace prefs { @@ -1558,7 +1557,7 @@ const char kGeolocationAccessToken[] = "geolocation.access_token"; const char kGeolocationEnabled[] = "geolocation.enabled"; #endif -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) // Boolean that is true when Google services can use the user's location. const char kGoogleGeolocationAccessEnabled[] = "googlegeolocationaccess.enabled"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 79e1d12a..f82326b 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -10,7 +10,6 @@ #include <stddef.h> #include "build/build_config.h" -#include "chrome/common/features.h" namespace prefs { @@ -558,7 +557,7 @@ extern const char kGeolocationAccessToken[]; extern const char kGeolocationEnabled[]; #endif -#if BUILDFLAG(ENABLE_GOOGLE_NOW) +#if defined(ENABLE_GOOGLE_NOW) extern const char kGoogleGeolocationAccessEnabled[]; #endif extern const char kGoogleNowLauncherEnabled[]; diff --git a/chrome/common_constants.gyp b/chrome/common_constants.gyp index c69a075..134878e 100644 --- a/chrome/common_constants.gyp +++ b/chrome/common_constants.gyp @@ -72,7 +72,6 @@ # GN version: //chrome/common:constants 'target_name': 'common_constants', 'type': 'static_library', - 'hard_dependency': 1, # Because of transitive dep on version_header. 'sources': [ '<@(common_constants_sources)' ], diff --git a/tools/grit/grit/util.py b/tools/grit/grit/util.py index 93dce26..b958bc2 100755 --- a/tools/grit/grit/util.py +++ b/tools/grit/grit/util.py @@ -483,8 +483,7 @@ def ParseDefine(define): '''Parses a define argument and returns the name and value. The format is either "NAME=VAL" or "NAME", using True as the default value. - Values of "1"/"true" and "0"/"false" are transformed to True and False - respectively. + Values of "1" and "0" are transformed to True and False respectively. Args: define: a string of the form "NAME=VAL" or "NAME". @@ -498,8 +497,8 @@ def ParseDefine(define): val = True if len(parts) > 1: val = parts[1] - if val == "1" or val == "true": val = True - elif val == "0" or val == "false": val = False + if val == "1": val = True + elif val == "0": val = False return (name, val) diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni index f60d8fa..083e3d9 100644 --- a/tools/grit/grit_rule.gni +++ b/tools/grit/grit_rule.gni @@ -244,6 +244,13 @@ if (enable_settings_app) { "enable_settings_app", ] } +if (enable_google_now) { + grit_defines += [ + "-D", + "enable_google_now", + ] +} + if (enable_webrtc) { grit_defines += [ "-D", |