Commit 55a272ad authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

oobe: s/OFFICIAL_BUILD/GOOGLE_CHROME_BRANDING flag

Fixed: 1047219
Change-Id: I8d8dfcb7052986ea8f2625fa5385891a5a49d1a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030946
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736932}
parent afb046fb
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/policy/auto_enrollment_client_impl.h" #include "chrome/browser/chromeos/policy/auto_enrollment_client_impl.h"
...@@ -155,16 +156,16 @@ std::string AutoEnrollmentStateToString(policy::AutoEnrollmentState state) { ...@@ -155,16 +156,16 @@ std::string AutoEnrollmentStateToString(policy::AutoEnrollmentState state) {
} }
// Returns true if this is an official build and the device has Chrome firmware. // Returns true if this is an official build and the device has Chrome firmware.
bool IsOfficialChrome() { bool IsGoogleBrandedChrome() {
std::string firmware_type; std::string firmware_type;
bool is_official = bool is_chrome_branded =
!system::StatisticsProvider::GetInstance()->GetMachineStatistic( !system::StatisticsProvider::GetInstance()->GetMachineStatistic(
system::kFirmwareTypeKey, &firmware_type) || system::kFirmwareTypeKey, &firmware_type) ||
firmware_type != system::kFirmwareTypeValueNonchrome; firmware_type != system::kFirmwareTypeValueNonchrome;
#if !defined(OFFICIAL_BUILD) #if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
is_official = false; is_chrome_branded = false;
#endif #endif
return is_official; return is_chrome_branded;
} }
// Schedules immediate initialization of the |DeviceManagementService| and // Schedules immediate initialization of the |DeviceManagementService| and
...@@ -333,7 +334,7 @@ bool AutoEnrollmentController::IsFREEnabled() { ...@@ -333,7 +334,7 @@ bool AutoEnrollmentController::IsFREEnabled() {
if (command_line_mode.empty() || if (command_line_mode.empty() ||
command_line_mode == kForcedReEnrollmentOfficialBuild) { command_line_mode == kForcedReEnrollmentOfficialBuild) {
return IsOfficialChrome(); return IsGoogleBrandedChrome();
} }
if (command_line_mode == kForcedReEnrollmentNever) if (command_line_mode == kForcedReEnrollmentNever)
...@@ -349,7 +350,7 @@ bool AutoEnrollmentController::IsInitialEnrollmentEnabled() { ...@@ -349,7 +350,7 @@ bool AutoEnrollmentController::IsInitialEnrollmentEnabled() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kEnterpriseEnableInitialEnrollment)) if (!command_line->HasSwitch(switches::kEnterpriseEnableInitialEnrollment))
return IsOfficialChrome(); return IsGoogleBrandedChrome();
std::string command_line_mode = command_line->GetSwitchValueASCII( std::string command_line_mode = command_line->GetSwitchValueASCII(
switches::kEnterpriseEnableInitialEnrollment); switches::kEnterpriseEnableInitialEnrollment);
...@@ -358,7 +359,7 @@ bool AutoEnrollmentController::IsInitialEnrollmentEnabled() { ...@@ -358,7 +359,7 @@ bool AutoEnrollmentController::IsInitialEnrollmentEnabled() {
if (command_line_mode.empty() || if (command_line_mode.empty() ||
command_line_mode == kInitialEnrollmentOfficialBuild) { command_line_mode == kInitialEnrollmentOfficialBuild) {
return IsOfficialChrome(); return IsGoogleBrandedChrome();
} }
if (command_line_mode == kInitialEnrollmentNever) if (command_line_mode == kInitialEnrollmentNever)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ash/public/cpp/login_screen.h" #include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/login_screen_model.h" #include "ash/public/cpp/login_screen_model.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "chrome/common/channel_info.h" #include "chrome/common/channel_info.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/version_info/channel.h" #include "components/version_info/channel.h"
...@@ -19,10 +20,10 @@ MojoSystemInfoDispatcher::MojoSystemInfoDispatcher() = default; ...@@ -19,10 +20,10 @@ MojoSystemInfoDispatcher::MojoSystemInfoDispatcher() = default;
MojoSystemInfoDispatcher::~MojoSystemInfoDispatcher() = default; MojoSystemInfoDispatcher::~MojoSystemInfoDispatcher() = default;
void MojoSystemInfoDispatcher::StartRequest() { void MojoSystemInfoDispatcher::StartRequest() {
#if defined(OFFICIAL_BUILD) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
version_info_updater_.StartUpdate(true /*is_official_build*/); version_info_updater_.StartUpdate(true /*is_chrome_branded*/);
#else #else
version_info_updater_.StartUpdate(false /*is_official_build*/); version_info_updater_.StartUpdate(false /*is_chrome_branded*/);
#endif #endif
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/values.h" #include "base/values.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/browser_process_platform_part_chromeos.h" #include "chrome/browser/browser_process_platform_part_chromeos.h"
...@@ -170,9 +171,10 @@ ResetScreen::ResetScreen(ResetView* view, ...@@ -170,9 +171,10 @@ ResetScreen::ResetScreen(ResetView* view,
view_->SetIsTpmFirmwareUpdateEditable(true); view_->SetIsTpmFirmwareUpdateEditable(true);
view_->SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode::kPowerwash); view_->SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode::kPowerwash);
view_->SetIsConfirmational(false); view_->SetIsConfirmational(false);
view_->SetIsOfficialBuild(false); #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#if defined(OFFICIAL_BUILD) view_->SetIsGoogleBrandedBuild(true);
view_->SetIsOfficialBuild(true); #else
view_->SetIsGoogleBrandedBuild(false);
#endif #endif
} }
} }
...@@ -404,7 +406,7 @@ void ResetScreen::OnConfirmationDismissed() { ...@@ -404,7 +406,7 @@ void ResetScreen::OnConfirmationDismissed() {
} }
void ResetScreen::ShowHelpArticle(HelpAppLauncher::HelpTopic topic) { void ResetScreen::ShowHelpArticle(HelpAppLauncher::HelpTopic topic) {
#if defined(OFFICIAL_BUILD) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
VLOG(1) << "Trying to view help article " << topic; VLOG(1) << "Trying to view help article " << topic;
if (!help_app_.get()) { if (!help_app_.get()) {
help_app_ = new HelpAppLauncher( help_app_ = new HelpAppLauncher(
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h"
#include "chrome/browser/chromeos/login/screen_manager.h" #include "chrome/browser/chromeos/login/screen_manager.h"
#include "chrome/browser/chromeos/login/screens/network_error.h" #include "chrome/browser/chromeos/login/screens/network_error.h"
...@@ -70,7 +71,7 @@ void UpdateScreen::OnViewDestroyed(UpdateView* view) { ...@@ -70,7 +71,7 @@ void UpdateScreen::OnViewDestroyed(UpdateView* view) {
} }
void UpdateScreen::Show() { void UpdateScreen::Show() {
#if !defined(OFFICIAL_BUILD) #if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (view_) { if (view_) {
view_->SetCancelUpdateShortcutEnabled(true); view_->SetCancelUpdateShortcutEnabled(true);
} }
...@@ -92,12 +93,13 @@ void UpdateScreen::Hide() { ...@@ -92,12 +93,13 @@ void UpdateScreen::Hide() {
} }
void UpdateScreen::OnUserAction(const std::string& action_id) { void UpdateScreen::OnUserAction(const std::string& action_id) {
bool is_official_build = false; bool is_chrome_branded_build = false;
#if defined(OFFICIAL_BUILD) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
is_official_build = true; is_chrome_branded_build = true;
#endif #endif
if (!is_official_build && action_id == kUserActionCancelUpdateShortcut) { if (!is_chrome_branded_build &&
action_id == kUserActionCancelUpdateShortcut) {
// Skip update UI, usually used only in debug builds/tests. // Skip update UI, usually used only in debug builds/tests.
VLOG(1) << "Forced update cancel"; VLOG(1) << "Forced update cancel";
ExitUpdate(Result::UPDATE_NOT_REQUIRED); ExitUpdate(Result::UPDATE_NOT_REQUIRED);
......
...@@ -62,14 +62,14 @@ VersionInfoUpdater::~VersionInfoUpdater() { ...@@ -62,14 +62,14 @@ VersionInfoUpdater::~VersionInfoUpdater() {
policy_manager->core()->store()->RemoveObserver(this); policy_manager->core()->store()->RemoveObserver(this);
} }
void VersionInfoUpdater::StartUpdate(bool is_official_build) { void VersionInfoUpdater::StartUpdate(bool is_chrome_branded) {
if (base::SysInfo::IsRunningOnChromeOS()) { if (base::SysInfo::IsRunningOnChromeOS()) {
base::PostTaskAndReplyWithResult( base::PostTaskAndReplyWithResult(
FROM_HERE, FROM_HERE,
{base::ThreadPool(), base::MayBlock(), {base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE}, base::TaskPriority::USER_VISIBLE},
base::BindOnce(&version_loader::GetVersion, base::BindOnce(&version_loader::GetVersion,
is_official_build is_chrome_branded
? version_loader::VERSION_SHORT_WITH_DATE ? version_loader::VERSION_SHORT_WITH_DATE
: version_loader::VERSION_FULL), : version_loader::VERSION_FULL),
base::BindOnce(&VersionInfoUpdater::OnVersion, base::BindOnce(&VersionInfoUpdater::OnVersion,
......
...@@ -54,7 +54,7 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer { ...@@ -54,7 +54,7 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
// Starts fetching version info. The delegate will be notified when update // Starts fetching version info. The delegate will be notified when update
// is received. // is received.
void StartUpdate(bool is_official_build); void StartUpdate(bool is_chrome_branded);
// Determine whether the system information will be displayed forcedly. // Determine whether the system information will be displayed forcedly.
base::Optional<bool> IsSystemInfoEnforced() const; base::Optional<bool> IsSystemInfoEnforced() const;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
[[i18nDynamic(locale, 'resetRestartMessage')]] [[i18nDynamic(locale, 'resetRestartMessage')]]
</div> </div>
<a id="powerwash-help-link-md" href="#" <a id="powerwash-help-link-md" href="#"
hidden="[[isHelpLinkHidden_(uiState_, isOfficial_)]]" hidden="[[isHelpLinkHidden_(uiState_, isGoogleBranded_)]]"
on-tap="onLearnMoreTap_"> on-tap="onLearnMoreTap_">
[[i18nDynamic(locale, 'learnMore')]] [[i18nDynamic(locale, 'learnMore')]]
</a> </a>
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
<span> <span>
[[i18nDynamic(locale, 'resetTPMFirmwareUpdate')]] [[i18nDynamic(locale, 'resetTPMFirmwareUpdate')]]
</span> </span>
<a href="#" hidden="[[isHelpLinkHidden_(uiState_, isOfficial_)]]" <a href="#"
hidden="[[isHelpLinkHidden_(uiState_, isGoogleBranded_)]]"
on-tap="onTPMFirmwareUpdateLearnMore_"> on-tap="onTPMFirmwareUpdateLearnMore_">
[[i18nDynamic(locale, 'learnMore')]] [[i18nDynamic(locale, 'learnMore')]]
</a> </a>
......
...@@ -21,7 +21,7 @@ Polymer({ ...@@ -21,7 +21,7 @@ Polymer({
/** /**
* Flag that determines whether help link is shown. * Flag that determines whether help link is shown.
*/ */
isOfficial_: Boolean, isGoogleBranded_: Boolean,
/** /**
* Whether to show the TPM firmware update checkbox. * Whether to show the TPM firmware update checkbox.
...@@ -62,8 +62,8 @@ Polymer({ ...@@ -62,8 +62,8 @@ Polymer({
}, },
/** @private */ /** @private */
isHelpLinkHidden_(uiState_, isOfficial_) { isHelpLinkHidden_(uiState_, isGoogleBranded_) {
return !isOfficial_ || (uiState_ == 'revert-promise-view'); return !isGoogleBranded_ || (uiState_ == 'revert-promise-view');
}, },
/** @private */ /** @private */
......
...@@ -35,7 +35,7 @@ login.createScreen('ResetScreen', 'reset', function() { ...@@ -35,7 +35,7 @@ login.createScreen('ResetScreen', 'reset', function() {
'setIsTpmFirmwareUpdateEditable', 'setIsTpmFirmwareUpdateEditable',
'setTpmFirmwareUpdateMode', 'setTpmFirmwareUpdateMode',
'setIsConfirmational', 'setIsConfirmational',
'setIsOfficialBuild', 'setIsGoogleBrandedBuild',
'setScreenState', 'setScreenState',
], ],
...@@ -53,8 +53,6 @@ login.createScreen('ResetScreen', 'reset', function() { ...@@ -53,8 +53,6 @@ login.createScreen('ResetScreen', 'reset', function() {
tpmFirmwareUpdateMode_: RESET_SCREEN_UI_STATE.REVERT_PROMISE, tpmFirmwareUpdateMode_: RESET_SCREEN_UI_STATE.REVERT_PROMISE,
/** @type {boolean} */ /** @type {boolean} */
isConfirmational_: false, isConfirmational_: false,
/** @type {boolean} */
isOfficialBuild_: false,
/** @type {RESET_SCREEN_STATE} */ /** @type {RESET_SCREEN_STATE} */
screenState_: RESET_SCREEN_STATE.RESTART_REQUIRED, screenState_: RESET_SCREEN_STATE.RESTART_REQUIRED,
...@@ -100,10 +98,8 @@ login.createScreen('ResetScreen', 'reset', function() { ...@@ -100,10 +98,8 @@ login.createScreen('ResetScreen', 'reset', function() {
} }
}, },
setIsOfficialBuild(isOfficial) { setIsGoogleBrandedBuild(isGoogleBranded) {
this.isOfficialBuild_ = isOfficial; $('oobe-reset-md').isGoogleBranded_ = isGoogleBranded;
$('oobe-reset-md').isOfficial_ = isOfficial;
}, },
setScreenState(state) { setScreenState(state) {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
...@@ -163,7 +164,7 @@ void CoreOobeHandler::DeclareLocalizedValues( ...@@ -163,7 +164,7 @@ void CoreOobeHandler::DeclareLocalizedValues(
void CoreOobeHandler::Initialize() { void CoreOobeHandler::Initialize() {
UpdateA11yState(); UpdateA11yState();
UpdateOobeUIVisibility(); UpdateOobeUIVisibility();
#if defined(OFFICIAL_BUILD) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
version_info_updater_.StartUpdate(true); version_info_updater_.StartUpdate(true);
#else #else
version_info_updater_.StartUpdate(false); version_info_updater_.StartUpdate(false);
......
...@@ -147,8 +147,8 @@ void ResetScreenHandler::SetIsConfirmational(bool value) { ...@@ -147,8 +147,8 @@ void ResetScreenHandler::SetIsConfirmational(bool value) {
CallJS("login.ResetScreen.setIsConfirmational", value); CallJS("login.ResetScreen.setIsConfirmational", value);
} }
void ResetScreenHandler::SetIsOfficialBuild(bool value) { void ResetScreenHandler::SetIsGoogleBrandedBuild(bool value) {
CallJS("login.ResetScreen.setIsOfficialBuild", value); CallJS("login.ResetScreen.setIsGoogleBrandedBuild", value);
} }
void ResetScreenHandler::SetScreenState(State value) { void ResetScreenHandler::SetScreenState(State value) {
......
...@@ -42,7 +42,7 @@ class ResetView { ...@@ -42,7 +42,7 @@ class ResetView {
virtual void SetIsTpmFirmwareUpdateEditable(bool value) = 0; virtual void SetIsTpmFirmwareUpdateEditable(bool value) = 0;
virtual void SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode value) = 0; virtual void SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode value) = 0;
virtual void SetIsConfirmational(bool value) = 0; virtual void SetIsConfirmational(bool value) = 0;
virtual void SetIsOfficialBuild(bool value) = 0; virtual void SetIsGoogleBrandedBuild(bool value) = 0;
virtual void SetScreenState(State value) = 0; virtual void SetScreenState(State value) = 0;
virtual State GetScreenState() = 0; virtual State GetScreenState() = 0;
...@@ -79,7 +79,7 @@ class ResetScreenHandler : public ResetView, ...@@ -79,7 +79,7 @@ class ResetScreenHandler : public ResetView,
void SetIsTpmFirmwareUpdateEditable(bool value) override; void SetIsTpmFirmwareUpdateEditable(bool value) override;
void SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode value) override; void SetTpmFirmwareUpdateMode(tpm_firmware_update::Mode value) override;
void SetIsConfirmational(bool value) override; void SetIsConfirmational(bool value) override;
void SetIsOfficialBuild(bool value) override; void SetIsGoogleBrandedBuild(bool value) override;
void SetScreenState(State value) override; void SetScreenState(State value) override;
State GetScreenState() override; State GetScreenState() override;
tpm_firmware_update::Mode GetTpmFirmwareUpdateMode() override; tpm_firmware_update::Mode GetTpmFirmwareUpdateMode() override;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "base/values.h" #include "base/values.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/chromeos/login/oobe_screen.h" #include "chrome/browser/chromeos/login/oobe_screen.h"
#include "chrome/browser/chromeos/login/screens/update_screen.h" #include "chrome/browser/chromeos/login/screens/update_screen.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
...@@ -97,7 +98,7 @@ void UpdateScreenHandler::DeclareLocalizedValues( ...@@ -97,7 +98,7 @@ void UpdateScreenHandler::DeclareLocalizedValues(
IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES); IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES);
builder->Add("downloadingTimeLeftSmall", IDS_DOWNLOADING_TIME_LEFT_SMALL); builder->Add("downloadingTimeLeftSmall", IDS_DOWNLOADING_TIME_LEFT_SMALL);
#if !defined(OFFICIAL_BUILD) #if !BUILDFLAG(GOOGLE_CHROME_BRANDING)
builder->Add("cancelUpdateHint", IDS_UPDATE_CANCEL); builder->Add("cancelUpdateHint", IDS_UPDATE_CANCEL);
builder->Add("cancelledUpdateMessage", IDS_UPDATE_CANCELLED); builder->Add("cancelledUpdateMessage", IDS_UPDATE_CANCELLED);
#else #else
......
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