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