Commit e7fd9406 authored by sdefresne's avatar sdefresne Committed by Commit bot

Convert //ios/chrome/browser:about_flags to use buildflag_header.

The template buildflag_header allows generating a header file with
defines based on gn variables. This is better than using "defines"
on a target as only the files using the macro will depend on it
instead of all files in the target.

BUG=None

Review-Url: https://codereview.chromium.org/2569663002
Cr-Commit-Position: refs/heads/master@{#437858}
parent 45a928c0
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ios/rules.gni") import("//build/config/ios/rules.gni")
import("//third_party/protobuf/proto_library.gni") import("//third_party/protobuf/proto_library.gni")
...@@ -21,6 +22,8 @@ declare_args() { ...@@ -21,6 +22,8 @@ declare_args() {
source_set("browser") { source_set("browser") {
sources = [ sources = [
"about_flags.h",
"about_flags.mm",
"app_startup_parameters.h", "app_startup_parameters.h",
"app_startup_parameters.mm", "app_startup_parameters.mm",
"application_context.cc", "application_context.cc",
...@@ -74,10 +77,14 @@ source_set("browser") { ...@@ -74,10 +77,14 @@ source_set("browser") {
"xcallback_parameters.mm", "xcallback_parameters.mm",
] ]
deps = [ deps = [
":google_api_keys_header",
":settings_resources", ":settings_resources",
"//base", "//base",
"//components/autofill/core/browser", "//components/autofill/core/browser",
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/dom_distiller/core",
"//components/flags_ui",
"//components/flags_ui:switches",
"//components/gcm_driver", "//components/gcm_driver",
"//components/handoff", "//components/handoff",
"//components/keyed_service/core", "//components/keyed_service/core",
...@@ -95,12 +102,16 @@ source_set("browser") { ...@@ -95,12 +102,16 @@ source_set("browser") {
"//components/search_engines", "//components/search_engines",
"//components/signin/core/browser", "//components/signin/core/browser",
"//components/ssl_config", "//components/ssl_config",
"//components/strings",
"//components/sync",
"//components/translate/core/browser", "//components/translate/core/browser",
"//components/url_formatter", "//components/url_formatter",
"//components/variations", "//components/variations",
"//components/variations/service", "//components/variations/service",
"//components/version_info", "//components/version_info",
"//components/webdata_services", "//components/webdata_services",
"//google_apis",
"//ios/chrome/app/strings",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/sync/glue", "//ios/chrome/browser/sync/glue",
"//ios/chrome/common", "//ios/chrome/common",
...@@ -128,7 +139,6 @@ source_set("browser_impl") { ...@@ -128,7 +139,6 @@ source_set("browser_impl") {
"ios_chrome_main_parts.mm", "ios_chrome_main_parts.mm",
] ]
deps = [ deps = [
":about_flags",
":browser", ":browser",
"//base", "//base",
"//components/component_updater", "//components/component_updater",
...@@ -180,35 +190,9 @@ source_set("browser_impl") { ...@@ -180,35 +190,9 @@ source_set("browser_impl") {
} }
} }
# This is a separate target so that the 'defines' does not leak to the buildflag_header("google_api_keys_header") {
# other files (which would increase the compilation time when changing header = "google_api_keys.h"
# the value). flags = [
source_set("about_flags") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"about_flags.h",
"about_flags.mm",
]
deps = [
":browser",
"//base",
"//components/autofill/core/common",
"//components/dom_distiller/core",
"//components/flags_ui",
"//components/flags_ui:switches",
"//components/ntp_tiles",
"//components/reading_list/core",
"//components/strings",
"//components/sync",
"//components/variations",
"//google_apis",
"//ios/chrome/app/strings",
"//ios/web",
"//ios/web:user_agent",
]
defines = [
"GOOGLE_STAGING_API_URL=\"$google_staging_api_url\"", "GOOGLE_STAGING_API_URL=\"$google_staging_api_url\"",
"GOOGLE_STAGING_LSO_URL=\"$google_staging_lso_url\"", "GOOGLE_STAGING_LSO_URL=\"$google_staging_lso_url\"",
"GOOGLE_TEST_API_URL=\"$google_test_api_url\"", "GOOGLE_TEST_API_URL=\"$google_test_api_url\"",
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_driver_switches.h"
#include "google_apis/gaia/gaia_switches.h" #include "google_apis/gaia/gaia_switches.h"
#include "ios/chrome/browser/chrome_switches.h" #include "ios/chrome/browser/chrome_switches.h"
#include "ios/chrome/browser/google_api_keys.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#include "ios/web/public/user_agent.h" #include "ios/web/public/user_agent.h"
#include "ios/web/public/web_view_creation_util.h" #include "ios/web/public/web_view_creation_util.h"
...@@ -39,10 +40,6 @@ ...@@ -39,10 +40,6 @@
#include "components/variations/variations_switches.h" #include "components/variations/variations_switches.h"
#endif #endif
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace { namespace {
// To add a new entry, add to the end of kFeatureEntries. There are two // To add a new entry, add to the end of kFeatureEntries. There are two
// distinct types of entries: // distinct types of entries:
...@@ -79,19 +76,22 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { ...@@ -79,19 +76,22 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
NSString* gaia_environment = [defaults stringForKey:kGAIAEnvironment]; NSString* gaia_environment = [defaults stringForKey:kGAIAEnvironment];
if ([gaia_environment isEqualToString:@"Staging"]) { if ([gaia_environment isEqualToString:@"Staging"]) {
command_line->AppendSwitchASCII(switches::kGoogleApisUrl, command_line->AppendSwitchASCII(switches::kGoogleApisUrl,
GOOGLE_STAGING_API_URL); BUILDFLAG(GOOGLE_STAGING_API_URL));
command_line->AppendSwitchASCII(switches::kLsoUrl, GOOGLE_STAGING_LSO_URL); command_line->AppendSwitchASCII(switches::kLsoUrl,
BUILDFLAG(GOOGLE_STAGING_LSO_URL));
} else if ([gaia_environment isEqualToString:@"Test"]) { } else if ([gaia_environment isEqualToString:@"Test"]) {
command_line->AppendSwitchASCII(switches::kGaiaUrl, GOOGLE_TEST_OAUTH_URL); command_line->AppendSwitchASCII(switches::kGaiaUrl,
BUILDFLAG(GOOGLE_TEST_OAUTH_URL));
command_line->AppendSwitchASCII(switches::kGoogleApisUrl, command_line->AppendSwitchASCII(switches::kGoogleApisUrl,
GOOGLE_TEST_API_URL); BUILDFLAG(GOOGLE_TEST_API_URL));
command_line->AppendSwitchASCII(switches::kLsoUrl, GOOGLE_TEST_LSO_URL); command_line->AppendSwitchASCII(switches::kLsoUrl,
BUILDFLAG(GOOGLE_TEST_LSO_URL));
command_line->AppendSwitchASCII(switches::kSyncServiceURL, command_line->AppendSwitchASCII(switches::kSyncServiceURL,
GOOGLE_TEST_SYNC_URL); BUILDFLAG(GOOGLE_TEST_SYNC_URL));
command_line->AppendSwitchASCII(switches::kOAuth2ClientID, command_line->AppendSwitchASCII(switches::kOAuth2ClientID,
GOOGLE_TEST_OAUTH_CLIENT_ID); BUILDFLAG(GOOGLE_TEST_OAUTH_CLIENT_ID));
command_line->AppendSwitchASCII(switches::kOAuth2ClientSecret, command_line->AppendSwitchASCII(switches::kOAuth2ClientSecret,
GOOGLE_TEST_OAUTH_CLIENT_SECRET); BUILDFLAG(GOOGLE_TEST_OAUTH_CLIENT_SECRET));
} }
// Populate command line flag for the Tab Switcher experiment from the // Populate command line flag for the Tab Switcher experiment from the
......
...@@ -38,7 +38,6 @@ source_set("webui") { ...@@ -38,7 +38,6 @@ source_set("webui") {
"//google_apis", "//google_apis",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser:about_flags",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/crash_report", "//ios/chrome/browser/crash_report",
"//ios/chrome/browser/metrics", "//ios/chrome/browser/metrics",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment