Commit 955ad497 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

More GOOGLE_CHROME_BUILD -> GOOGLE_CHROME_BRANDING replacements.

For helpers.h, move the GOOGLE_CHROME_BUILD into just the cc file, so
that the dep on //build:branding_buildflags doesn't have to be a
public_deps and to make branding affect internal APIs less. I'm hoping
to do more changes that move GOOGLE_CHROME_BUILD / GOOGLE_CHROME_BRANDING
from header files going forward.

Bug: 961769
Change-Id: I63f20a91b474865acaee2369900ed7677220468a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1822718
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700246}
parent b9bb8005
......@@ -11,6 +11,7 @@
#include "base/path_service.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_paths.h"
......@@ -132,7 +133,7 @@ bool ChromeCrashReporterClient::IsRunningUnattended() {
}
bool ChromeCrashReporterClient::GetCollectStatsConsent() {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
bool is_official_chrome_build = true;
#else
bool is_official_chrome_build = false;
......
......@@ -22,6 +22,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
......@@ -184,7 +185,7 @@
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
#endif // BUILDFLAG(ENABLE_PRINTING)
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
#endif
......@@ -534,13 +535,13 @@ void AddAvatarToLastMenuItem(const gfx::Image& icon,
// Adds Google icon to the last added menu item. Used for Google-powered
// services like translate and search.
void AddGoogleIconToLastMenuItem(ui::SimpleMenuModel* menu) {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (base::FeatureList::IsEnabled(features::kGoogleBrandedContextMenu)) {
menu->SetIcon(
menu->GetItemCount() - 1,
ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_GOOGLE_ICON));
}
#endif // defined(GOOGLE_CHROME_BUILD)
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
void OnProfileCreated(const GURL& link_url,
......
......@@ -55,6 +55,7 @@
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/startup/startup_tab_provider.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/welcome/helpers.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
......@@ -69,10 +70,6 @@
#include "rlz/buildflags/buildflags.h"
#include "ui/base/buildflags.h"
#if !defined(OS_CHROMEOS)
#include "chrome/browser/ui/webui/welcome/helpers.h"
#endif // !defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#import "chrome/browser/mac/dock.h"
......@@ -593,14 +590,15 @@ void StartupBrowserCreatorImpl::DetermineURLsAndLaunch(
const bool is_incognito_or_guest = profile_->IsOffTheRecord();
bool is_post_crash_launch = HasPendingUncleanExit(profile_);
bool has_incompatible_applications = false;
#if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#if defined(OS_WIN)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (is_post_crash_launch) {
// Check if there are any incompatible applications cached from the last
// Chrome run.
has_incompatible_applications =
IncompatibleApplicationsUpdater::HasCachedApplications();
}
#endif
welcome::JoinOnboardingGroup(profile_);
#endif
......
......@@ -107,7 +107,12 @@ bool CanShowSigninModule(const policy::PolicyMap& policies) {
policy::BrowserSigninMode::kDisabled;
}
#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
// Welcome experiments depend on Google being the default search provider.
static bool CanExperimentWithVariations(Profile* profile) {
return search::DefaultSearchProviderIsGoogle(profile);
}
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
// These feature flags are used to tie our experiment to specific studies.
// go/navi-app-variation for details.
// TODO(hcarmona): find a solution that scales better.
......@@ -119,21 +124,14 @@ const base::Feature kNaviNTPVariationEnabled = {
"NaviNTPVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kNaviShortcutVariationEnabled = {
"NaviShortcutVariationEnabled", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
// Welcome experiments depend on Google being the default search provider.
bool CanExperimentWithVariations(Profile* profile) {
return search::DefaultSearchProviderIsGoogle(profile);
}
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
// Get the group for users who onboard in this experiment.
// Groups are:
// - Specified by study
// - The same for all experiments in study
// - Incremented with each new version
// - Not reused
std::string GetOnboardingGroup(Profile* profile) {
static std::string GetOnboardingGroup(Profile* profile) {
if (!CanExperimentWithVariations(profile)) {
// If we cannot run any variations, we bucket the users into a separate
// synthetic group that we will ignore data for.
......@@ -146,8 +144,10 @@ std::string GetOnboardingGroup(Profile* profile) {
// "NaviOnboarding" match study name in configs.
return base::GetFieldTrialParamValue("NaviOnboarding", "onboarding-group");
}
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
void JoinOnboardingGroup(Profile* profile) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
PrefService* prefs = profile->GetPrefs();
std::string group;
......@@ -178,17 +178,17 @@ void JoinOnboardingGroup(Profile* profile) {
base::FeatureList::IsEnabled(kNaviNTPVariationEnabled);
else if (group.compare("ShortcutVariationSynthetic-008") == 0)
base::FeatureList::IsEnabled(kNaviShortcutVariationEnabled);
}
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) && defined(OS_WIN)
}
bool IsEnabled(Profile* profile) {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return base::FeatureList::IsEnabled(welcome::kFeature) ||
base::FeatureList::IsEnabled(welcome::kForceEnabled);
#else
// Allow enabling outside official builds for testing purposes.
return base::FeatureList::IsEnabled(welcome::kForceEnabled);
#endif // defined(GOOGLE_CHROME_BUILD)
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
bool IsAppVariationEnabled() {
......
......@@ -23,13 +23,12 @@ class PolicyMap;
class Profile;
namespace welcome {
#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
// Onboarding groups are used for running field trials related to first run
// experience. This will make a new profile join whatever group is currently
// active. Any profile that is already part of an onboarding group will remain
// in that group.
void JoinOnboardingGroup(Profile* profile);
#endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)
bool IsEnabled(Profile* profile);
......
......@@ -39,6 +39,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/current_module.h"
#include "base/win/embedded_i18n/language_selector.h"
#include "build/branding_buildflags.h"
#include "chrome/common/chrome_version.h"
#include "chrome/credential_provider/common/gcp_strings.h"
#include "chrome/credential_provider/gaiacp/gaia_resources.h"
......@@ -771,7 +772,7 @@ std::string GetDictStringUTF8(const std::unique_ptr<base::Value>& dict,
}
base::FilePath::StringType GetInstallParentDirectoryName() {
#if defined(GOOGLE_CHROME_BUILD)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
return FILE_PATH_LITERAL("Google");
#else
return FILE_PATH_LITERAL("Chromium");
......
......@@ -272,6 +272,7 @@ static_library("test_support") {
"//chrome/app/chrome_crash_reporter_client.cc",
"//chrome/app/chrome_crash_reporter_client_mac.mm",
]
deps += [ "//build:branding_buildflags" ]
public_deps += [
"//components/crash/content/app",
"//third_party/breakpad",
......
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