0

Convert RLZ to a buildflag header

Creates a new directory rlz/features for the gni file and the buildflag_header target.

Updates callers to depend on the new target and use the new flags.

Review-Url: https://codereview.chromium.org/2570573002
Cr-Commit-Position: refs/heads/master@{#438026}
This commit is contained in:
brettw
2016-12-12 19:28:37 -08:00
committed by Commit bot
parent 6582d0b551
commit 8fb852d9e6
33 changed files with 111 additions and 59 deletions

@ -136,9 +136,6 @@ config("feature_flags") {
if (!enable_nacl) {
defines += [ "DISABLE_NACL" ]
}
if (enable_rlz) {
defines += [ "ENABLE_RLZ" ]
}
if (enable_wayland_server) {
defines += [ "ENABLE_WAYLAND_SERVER=1" ]
}

@ -79,11 +79,6 @@ declare_args() {
# Additional dependent variables -----------------------------------------------
# Whether we are using the rlz library or not. Platforms like Android send
# rlz codes for searches but do not use the library.
enable_rlz_support = is_win || is_mac || is_ios || is_chromeos
enable_rlz = is_chrome_branded && enable_rlz_support
# Chrome OS: whether to also build the upcoming version of
# ChromeVox, which can then be enabled via a command-line switch.
enable_chromevox_next = false

@ -15,6 +15,7 @@ import("//media/media_options.gni")
import("//net/features.gni")
import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
import("//rlz/features/features.gni")
import("//sandbox/features.gni")
import("//third_party/protobuf/proto_library.gni")
import("//ui/base/ui_features.gni")
@ -1510,6 +1511,7 @@ split_static_library("browser") {
"//net:net_with_v8",
"//ppapi/features",
"//printing/features",
"//rlz/features",
"//services/image_decoder/public/cpp",
"//services/service_manager/public/cpp",
"//skia",

@ -38,6 +38,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/tracing_controller.h"
#include "printing/features/features.h"
#include "rlz/features/features.h"
#if defined(OS_WIN)
#include "chrome/browser/first_run/upgrade_util_win.h"
@ -52,7 +53,7 @@
#include "chrome/browser/background/background_mode_manager.h"
#endif
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif
@ -175,7 +176,7 @@ bool ShutdownPreThreadsStop() {
prefs->CommitPendingWrite();
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// Cleanup any statics created by RLZ. Must be done before NotificationService
// is destroyed.
rlz::RLZTracker::CleanupRlz();

@ -163,6 +163,7 @@
#include "net/http/http_stream_factory.h"
#include "net/url_request/url_request.h"
#include "printing/features/features.h"
#include "rlz/features/features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
#include "ui/base/material_design/material_design_controller.h"
@ -246,10 +247,10 @@
#include "printing/printed_document.h"
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "components/rlz/rlz_tracker.h"
#endif // defined(ENABLE_RLZ)
#endif // BUILDFLAG(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_WEBRTC)
#include "chrome/browser/media/webrtc/webrtc_log_util.h"
@ -1708,7 +1709,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}
#endif // defined(OS_WIN)
#if defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
#if BUILDFLAG(ENABLE_RLZ) && !defined(OS_CHROMEOS)
// Init the RLZ library. This just binds the dll and schedules a task on the
// file thread to be run sometime later. If this is the first run we record
// the installation event.
@ -1725,7 +1726,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
ChromeRLZTrackerDelegate::IsGoogleDefaultSearch(profile_),
ChromeRLZTrackerDelegate::IsGoogleHomepage(profile_),
ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile_));
#endif // defined(ENABLE_RLZ) && !defined(OS_CHROMEOS)
#endif // BUILDFLAG(ENABLE_RLZ) && !defined(OS_CHROMEOS)
// Configure modules that need access to resources.
net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider);

@ -148,12 +148,13 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context_getter.h"
#include "printing/backend/print_backend.h"
#include "rlz/features/features.h"
#include "ui/base/ime/chromeos/ime_keyboard.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/base/touch/touch_device.h"
#include "ui/events/event_utils.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif

@ -27,8 +27,9 @@
#include "google_apis/gaia/gaia_urls.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_response.h"
#include "rlz/features/features.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif
@ -36,7 +37,7 @@ namespace chromeos {
namespace {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
void GetAccessPointRlzInBackgroundThread(rlz_lib::AccessPoint point,
base::string16* rlz) {
ASSERT_FALSE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@ -81,7 +82,7 @@ class LoginUtilsTest : public OobeBaseTest {
DISALLOW_COPY_AND_ASSIGN(LoginUtilsTest);
};
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
IN_PROC_BROWSER_TEST_F(LoginUtilsTest, RlzInitialized) {
WaitForSigninScreen();

@ -114,11 +114,12 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
#include "net/cert/sth_distributor.h"
#include "rlz/features/features.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "url/gurl.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
#include "components/rlz/rlz_tracker.h"
#endif
@ -242,7 +243,7 @@ void InitLocaleAndInputMethodsForNewUser(
prefs->SetBoolean(prefs::kLanguageShouldMergeInputMethods, true);
}
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// Flag file that disables RLZ tracking, when present.
const base::FilePath::CharType kRLZDisabledFlagName[] =
FILE_PATH_LITERAL(".rlz_disabled");
@ -555,7 +556,7 @@ bool UserSessionManager::UserSessionsRestoreInProgress() const {
}
void UserSessionManager::InitRlz(Profile* profile) {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) {
// Read brand code asynchronously from an OEM data and repost ourselves.
google_brand::chromeos::InitBrand(
@ -1354,7 +1355,7 @@ void UserSessionManager::RestoreAuthSessionImpl(
}
void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
PrefService* local_state = g_browser_process->local_state();
if (disabled) {
// Empty brand code means an organic install (no RLZ pings are sent).

@ -7,6 +7,7 @@ import("//build/config/ui.gni")
import("//chrome/common/features.gni")
import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//rlz/features/features.gni")
assert(enable_extensions)
@ -897,6 +898,7 @@ static_library("extensions") {
"//net",
"//ppapi/features",
"//printing/features",
"//rlz/features",
"//skia",
"//sql",
"//storage/browser",

@ -25,8 +25,9 @@
#include "base/threading/thread_restrictions.h"
#include "base/win/windows_version.h"
#include "content/public/browser/browser_thread.h"
#include "rlz/features/features.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
#endif
@ -183,13 +184,13 @@ void GetMacAddress(const IsValidMacAddressCallback& is_valid_mac_address,
}
std::string GetRlzMachineId() {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
std::string machine_id;
if (!rlz_lib::GetMachineId(&machine_id))
return "";
return std::string();
return machine_id;
#else
return "";
return std::string();
#endif
}

@ -5,9 +5,10 @@
#include "build/build_config.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "extensions/test/extension_test_message_listener.h"
#include "rlz/features/features.h"
// Supported on all platforms, but on Windows only if RLZ is enabled.
#if !defined(OS_WIN) || defined(ENABLE_RLZ)
#if !defined(OS_WIN) || BUILDFLAG(ENABLE_RLZ)
class MusicManagerPrivateTest : public extensions::PlatformAppBrowserTest {
};

@ -34,9 +34,10 @@
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
#include "rlz/features/features.h"
#include "url/gurl.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
#endif
@ -84,7 +85,7 @@ GURL GetBackendUrl() {
// |result|.
bool HashWithMachineId(const std::string& salt, std::string* result) {
std::string machine_id;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
if (!rlz_lib::GetMachineId(&machine_id))
return false;
#else

@ -59,6 +59,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/features/features.h"
#include "rlz/features/features.h"
#include "sql/error_delegate_util.h"
#include "ui/base/resource/resource_bundle.h"
@ -72,9 +73,9 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
#endif // defined(ENABLE_RLZ)
#endif // BUILDFLAG(ENABLE_RLZ)
#endif // defined(OS_WIN)
using content::BrowserContext;
@ -399,7 +400,7 @@ void HandleReadError(const base::FilePath& pref_filename,
std::unique_ptr<ProfilePrefStoreManager> CreateProfilePrefStoreManager(
const base::FilePath& profile_path) {
std::string device_id;
#if defined(OS_WIN) && defined(ENABLE_RLZ)
#if defined(OS_WIN) && BUILDFLAG(ENABLE_RLZ)
// This is used by
// chrome/browser/extensions/api/music_manager_private/device_id_win.cc
// but that API is private (http://crbug.com/276485) and other platforms are

@ -11,9 +11,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#if defined(OS_CHROMEOS)
#include "chromeos/cryptohome/system_salt_getter.h"
#endif
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_ppapi_host.h"
@ -23,7 +20,13 @@
#include "crypto/random.h"
#include "crypto/sha2.h"
#include "ppapi/c/pp_errors.h"
#if defined(ENABLE_RLZ)
#include "rlz/features/features.h"
#if defined(OS_CHROMEOS)
#include "chromeos/cryptohome/system_salt_getter.h"
#endif
#if BUILDFLAG(ENABLE_RLZ)
#include "rlz/lib/machine_id.h"
#endif
@ -41,7 +44,7 @@ const uint32_t kSaltLength = 32;
void GetMachineIDAsync(
const base::Callback<void(const std::string&)>& callback) {
#if defined(OS_WIN) && defined(ENABLE_RLZ)
#if defined(OS_WIN) && BUILDFLAG(ENABLE_RLZ)
std::string result;
rlz_lib::GetMachineId(&result);
callback.Run(result);

@ -23,8 +23,9 @@
#include "components/search_engines/default_search_manager.h"
#include "components/search_engines/search_engines_pref_names.h"
#include "components/search_engines/template_url_service.h"
#include "rlz/features/features.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif
@ -43,7 +44,7 @@ TemplateURLServiceFactory* TemplateURLServiceFactory::GetInstance() {
std::unique_ptr<KeyedService> TemplateURLServiceFactory::BuildInstanceFor(
content::BrowserContext* context) {
base::Closure dsp_change_callback;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
dsp_change_callback = base::Bind(
base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent), rlz_lib::CHROME,
rlz::RLZTracker::ChromeOmnibox(), rlz_lib::SET_TO_GOOGLE);

@ -25,10 +25,11 @@
#include "components/search/search.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "rlz/features/features.h"
#include "ui/base/device_form_factor.h"
#include "url/gurl.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h"
#endif
@ -74,7 +75,7 @@ base::string16 UIThreadSearchTermsData::GetRlzParameterValue(
DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::UI));
base::string16 rlz_string;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// For organic brandcodes do not use rlz at all. Empty brandcode usually
// means a chromium install. This is ok.
std::string brand;

@ -12,6 +12,7 @@ import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
import("//rlz/features/features.gni")
import("//ui/base/ui_features.gni")
config("ui_warnings") {
@ -572,6 +573,7 @@ split_static_library("ui") {
"//net:net_with_v8",
"//ppapi/features",
"//printing/features",
"//rlz/features",
"//services/service_manager/runner/common",
"//skia",
"//storage/browser",

@ -22,13 +22,14 @@
#include "extensions/common/manifest_handlers/options_page_info.h"
#include "extensions/common/manifest_url_handlers.h"
#include "net/base/url_util.h"
#include "rlz/features/features.h"
#include "ui/app_list/app_list_folder_item.h"
#include "ui/app_list/app_list_item.h"
#include "ui/app_list/app_list_model.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/gfx/geometry/rect.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#endif
@ -203,7 +204,7 @@ void AppListControllerDelegate::GetApps(Profile* profile,
}
void AppListControllerDelegate::OnSearchStarted() {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
rlz::RLZTracker::RecordAppListSearch();
#endif
}

@ -87,6 +87,7 @@
#include "extensions/features/features.h"
#include "net/base/escape.h"
#include "printing/features/features.h"
#include "rlz/features/features.h"
#include "ui/events/keycodes/keyboard_codes.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
@ -110,7 +111,7 @@
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
#endif // BUILDFLAG(ENABLE_PRINTING)
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#endif
@ -473,7 +474,7 @@ void Home(Browser* browser, WindowOpenDisposition disposition) {
content::RecordAction(UserMetricsAction("Home"));
std::string extra_headers;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// If the home page is a Google home page, add the RLZ header to the request.
PrefService* pref_service = browser->profile()->GetPrefs();
if (pref_service) {
@ -483,7 +484,7 @@ void Home(Browser* browser, WindowOpenDisposition disposition) {
rlz::RLZTracker::ChromeHomePage());
}
}
#endif // defined(ENABLE_RLZ)
#endif // BUILDFLAG(ENABLE_RLZ)
GURL url = browser->profile()->GetHomePage();

@ -103,6 +103,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "net/base/network_change_notifier.h"
#include "rlz/features/features.h"
#include "ui/base/l10n/l10n_util.h"
#if defined(OS_MACOSX)
@ -117,7 +118,7 @@
#include "chrome/browser/shell_integration_win.h"
#endif
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#endif
@ -471,12 +472,12 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser,
: WindowOpenDisposition::NEW_BACKGROUND_TAB;
params.tabstrip_add_types = add_types;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
if (process_startup && google_util::IsGoogleHomePageUrl(tabs[i].url)) {
params.extra_headers = rlz::RLZTracker::GetAccessPointHttpHeader(
rlz::RLZTracker::ChromeHomePage());
}
#endif // defined(ENABLE_RLZ)
#endif // BUILDFLAG(ENABLE_RLZ)
chrome::Navigate(&params);

@ -23,6 +23,7 @@
#include "components/login/localized_values_builder.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "rlz/features/features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
@ -131,7 +132,7 @@ void EulaScreenHandler::DeclareLocalizedValues(
builder->Add("eulaTpmBusy", IDS_EULA_TPM_BUSY);
builder->Add("eulaSystemInstallationSettingsOkButton", IDS_OK);
builder->Add("termsOfServiceLoading", IDS_TERMS_OF_SERVICE_SCREEN_LOADING);
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
builder->AddF("eulaRlzDesc",
IDS_EULA_RLZ_DESCRIPTION,
IDS_SHORT_PRODUCT_NAME,
@ -161,7 +162,7 @@ void EulaScreenHandler::DeclareJSCallbacks() {
}
void EulaScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
dict->SetString("rlzEnabled", "enabled");
#else
dict->SetString("rlzEnabled", "disabled");

@ -16,6 +16,7 @@ import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//ppapi/features/features.gni")
import("//remoting/remoting_enable.gni")
import("//rlz/features/features.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/test.gni")
import("//ui/base/ui_features.gni")
@ -1228,6 +1229,7 @@ test("browser_tests") {
"//media:media_features",
"//ppapi/features",
"//printing/features",
"//rlz/features",
"//third_party/WebKit/public:features",
]

@ -11,6 +11,7 @@ include_rules = [
"+extensions",
"+mash/package",
"+mojo",
"+rlz/features",
"+services",
# Tests under chrome/ shouldn't need to access the internals of content/ and

@ -31,6 +31,7 @@
#include "extensions/common/constants.h"
#include "extensions/test/extension_test_message_listener.h"
#include "ppapi/shared_impl/test_utils.h"
#include "rlz/features/features.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
@ -1233,7 +1234,7 @@ TEST_PPAPI_OUT_OF_PROCESS(PDF)
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, FlashDRM) {
RunTest(
#if (defined(OS_WIN) && defined(ENABLE_RLZ)) || defined(OS_CHROMEOS)
#if (defined(OS_WIN) && BUILDFLAG(ENABLE_RLZ)) || defined(OS_CHROMEOS)
// Only implemented on Windows and ChromeOS currently.
LIST_TEST(FlashDRM_GetDeviceID)
#endif

@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//printing/features/features.gni")
import("//rlz/features/features.gni")
import("//testing/test.gni")
import("//tools/grit/repack.gni")

@ -5,6 +5,7 @@
import("//build/buildflag_header.gni")
import("//build/config/features.gni")
import("//build/config/ios/rules.gni")
import("//rlz/features/features.gni")
import("//third_party/protobuf/proto_library.gni")
declare_args() {
@ -121,6 +122,7 @@ source_set("browser") {
"//ios/web",
"//ios/web:user_agent",
"//net",
"//rlz/features",
"//url",
]
allow_circular_includes_from = [
@ -182,6 +184,7 @@ source_set("browser_impl") {
"//ios/web",
"//ios/web/public/app",
"//net",
"//rlz/features",
"//ui/base",
]

@ -94,6 +94,7 @@ include_rules = [
"+ios/public/provider/web",
"+ios/web/public",
"+net",
"+rlz/features",
"+third_party/brotli",
"+third_party/google_toolbox_for_mac",
"+ui",

@ -52,10 +52,11 @@
#include "net/http/http_network_layer.h"
#include "net/http/http_stream_factory.h"
#include "net/url_request/url_request.h"
#include "rlz/features/features.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#include "ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h" // nogncheck
#endif
@ -172,7 +173,7 @@ void IOSChromeMainParts::PreMainMessageLoopRun() {
ios::ChromeBrowserState* last_used_browser_state =
browser_state_manager->GetLastUsedBrowserState();
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// Init the RLZ library. This just schedules a task on the file thread to be
// run sometime later. If this is the first run we record the installation
// event.
@ -187,7 +188,7 @@ void IOSChromeMainParts::PreMainMessageLoopRun() {
RLZTrackerDelegateImpl::IsGoogleDefaultSearch(last_used_browser_state),
RLZTrackerDelegateImpl::IsGoogleHomepage(last_used_browser_state),
RLZTrackerDelegateImpl::IsGoogleInStartpages(last_used_browser_state));
#endif // defined(ENABLE_RLZ)
#endif // BUILDFLAG(ENABLE_RLZ)
TranslateServiceIOS::Initialize();
language_usage_metrics::LanguageUsageMetrics::RecordAcceptLanguages(

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/features.gni")
import("//rlz/features/features.gni")
source_set("search_engines") {
sources = [
@ -33,6 +34,7 @@ source_set("search_engines") {
"//ios/chrome/common",
"//ios/web",
"//net",
"//rlz/features",
"//ui/base",
"//url",
]

@ -20,8 +20,9 @@
#include "ios/chrome/browser/search_engines/template_url_service_client_impl.h"
#include "ios/chrome/browser/search_engines/ui_thread_search_terms_data.h"
#include "ios/chrome/browser/web_data_service_factory.h"
#include "rlz/features/features.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#endif
@ -29,7 +30,7 @@ namespace ios {
namespace {
base::Closure GetDefaultSearchProviderChangedCallback() {
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
return base::Bind(base::IgnoreResult(&rlz::RLZTracker::RecordProductEvent),
rlz_lib::CHROME, rlz::RLZTracker::ChromeOmnibox(),
rlz_lib::SET_TO_GOOGLE);

@ -18,9 +18,10 @@
#include "ios/chrome/common/channel_info.h"
#include "ios/web/public/web_thread.h"
#include "net/base/escape.h"
#include "rlz/features/features.h"
#include "url/gurl.h"
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
#include "components/rlz/rlz_tracker.h" // nogncheck
#endif
@ -60,7 +61,7 @@ base::string16 UIThreadSearchTermsData::GetRlzParameterValue(
DCHECK(!from_app_list);
DCHECK(thread_checker_.CalledOnValidThread());
base::string16 rlz_string;
#if defined(ENABLE_RLZ)
#if BUILDFLAG(ENABLE_RLZ)
// For organic brandcode do not use rlz at all.
std::string brand;
if (ios::google_brand::GetBrand(&brand) &&

11
rlz/features/BUILD.gn Normal file

@ -0,0 +1,11 @@
# Copyright 2016 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.
import("//build/buildflag_header.gni")
import("//rlz/features/features.gni")
buildflag_header("features") {
header = "features.h"
flags = [ "ENABLE_RLZ=$enable_rlz" ]
}

11
rlz/features/features.gni Normal file

@ -0,0 +1,11 @@
# Copyright 2016 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.
import("//build/config/chrome_build.gni")
# Whether we are using the rlz library or not. Platforms like Android send
# rlz codes for searches but do not use the library.
enable_rlz_support = is_win || is_mac || is_ios || is_chromeos
enable_rlz = is_chrome_branded && enable_rlz_support