Commit 27b9cc10 authored by Alex Ilin's avatar Alex Ilin Committed by Chromium LUCI CQ

[profiles] Showing customization bubble at the end of the force signin

The profile customization bubble at the end of the sign-in flow
allows the user to customize profile name and color.

We show the bubble only if the user doesn't already have a synced theme
color. We reuse the logic from ProfileCustomizationBubbleSyncController
that is used for non-force sign-in profile creation flow.

Bug: 1156096
Change-Id: Iae9d84e7f4ca5ca415058023e0b23b1260d96542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603297Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Alex Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840105}
parent 0bc58707
......@@ -2949,12 +2949,16 @@ static_library("ui") {
"webui/welcome/welcome_ui.h",
]
deps += [ "//components/country_codes" ]
deps += [
"//chrome/common/search:generate_colors_info",
"//components/country_codes",
]
if (enable_dice_support) {
sources += [
"signin/dice_web_signin_interceptor_delegate.cc",
"signin/dice_web_signin_interceptor_delegate.h",
"signin/profile_customization_bubble_sync_controller.h",
"views/profiles/dice_web_signin_interception_bubble_view.cc",
"views/profiles/dice_web_signin_interception_bubble_view.h",
"views/profiles/profile_customization_bubble_sync_controller.cc",
......
// Copyright 2020 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.
#ifndef CHROME_BROWSER_UI_SIGNIN_PROFILE_CUSTOMIZATION_BUBBLE_SYNC_CONTROLLER_H_
#define CHROME_BROWSER_UI_SIGNIN_PROFILE_CUSTOMIZATION_BUBBLE_SYNC_CONTROLLER_H_
#include "third_party/skia/include/core/SkColor.h"
class Browser;
// Implemented in
// chrome/browser/ui/views/profiles/profile_customization_bubble_sync_controller.cc
void ApplyProfileColorAndShowCustomizationBubbleWhenNoValueSynced(
Browser* browser,
SkColor suggested_profile_color);
#endif // CHROME_BROWSER_UI_SIGNIN_PROFILE_CUSTOMIZATION_BUBBLE_SYNC_CONTROLLER_H_
......@@ -7,6 +7,10 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h"
#include "chrome/browser/ui/views/profiles/profile_customization_bubble_view.h"
#include "components/sync/driver/sync_user_settings.h"
......@@ -137,3 +141,17 @@ void ProfileCustomizationBubbleSyncController::SkipBubble() {
std::move(show_bubble_callback_).Run(false);
delete this;
}
// Defined in
// chrome/browser/ui/signin/profile_customization_bubble_sync_controller.h
void ApplyProfileColorAndShowCustomizationBubbleWhenNoValueSynced(
Browser* browser,
SkColor suggested_profile_color) {
views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)
->toolbar_button_provider()
->GetAvatarToolbarButton();
DCHECK(anchor_view);
ProfileCustomizationBubbleSyncController::
ApplyColorAndShowBubbleWhenNoValueSynced(browser->profile(), anchor_view,
suggested_profile_color);
}
......@@ -365,8 +365,6 @@ void ProfilePickerView::OnProfileForSigninCreated(
if (signin_util::IsForceSigninEnabled()) {
// Show the embedded sign-in flow if the force signin is enabled.
// TODO(https://crbug.com/1156096): set the local profile name at the end of
// the sign-in flow and show the profile customization bubble.
UserManagerProfileDialog::ShowForceSigninDialog(
web_view_->GetWebContents()->GetBrowserContext(), profile->GetPath());
return;
......
......@@ -45,6 +45,8 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/signin/profile_colors_util.h"
#include "chrome/browser/ui/signin/profile_customization_bubble_sync_controller.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
......@@ -56,6 +58,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/browser/ui/webui/signin/signin_utils.h"
#include "chrome/browser/ui/webui/signin/signin_utils_desktop.h"
#include "chrome/common/search/selected_colors_info.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
......@@ -296,7 +299,11 @@ void OnSyncSetupComplete(Profile* profile,
primary_account);
}
SetProfileName(profile->GetPath(), profile_name);
// TODO(https://crbug.com/1156096): show the profile customization bubble.
Browser* browser = chrome::FindBrowserWithProfile(profile);
if (browser) {
ApplyProfileColorAndShowCustomizationBubbleWhenNoValueSynced(
browser, GenerateNewProfileColor().color);
}
}
if (!has_primary_account) {
......
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