Commit 7f99bf6d authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update ui/views for ephemeral Guest profiles.

Updates a few chrome/browser/ui/views/* classes for compatibility with
ephemeral Guest profiles.

This change is behind disabled |EnableEphemeralGuestProfilesOnDesktop|
flag.
Please see go/ephemeral-guest-profiles for more context.

Bug: 1125474
Change-Id: Ie4f8e4aaf1f981ba6575fe8cc38b62a009289626
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461375
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815679}
parent dcee7502
...@@ -778,7 +778,8 @@ void AppMenuModel::Build() { ...@@ -778,7 +778,8 @@ void AppMenuModel::Build() {
sub_menus_.back().get()); sub_menus_.back().get());
} }
AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS); AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
if (!browser_->profile()->IsGuestSession()) { if (!browser_->profile()->IsGuestSession() &&
!browser_->profile()->IsEphemeralGuestProfile()) {
bookmark_sub_menu_model_ = bookmark_sub_menu_model_ =
std::make_unique<BookmarkSubMenuModel>(this, browser_); std::make_unique<BookmarkSubMenuModel>(this, browser_);
AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU,
...@@ -939,7 +940,8 @@ void AppMenuModel::UpdateZoomControls() { ...@@ -939,7 +940,8 @@ void AppMenuModel::UpdateZoomControls() {
} }
bool AppMenuModel::ShouldShowNewIncognitoWindowMenuItem() { bool AppMenuModel::ShouldShowNewIncognitoWindowMenuItem() {
if (browser_->profile()->IsGuestSession()) if (browser_->profile()->IsGuestSession() ||
browser_->profile()->IsEphemeralGuestProfile())
return false; return false;
return IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != return IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
......
...@@ -771,7 +771,8 @@ bool BrowserView::IsIncognito() const { ...@@ -771,7 +771,8 @@ bool BrowserView::IsIncognito() const {
} }
bool BrowserView::IsGuestSession() const { bool BrowserView::IsGuestSession() const {
return browser_->profile()->IsGuestSession(); return browser_->profile()->IsGuestSession() ||
browser_->profile()->IsEphemeralGuestProfile();
} }
bool BrowserView::IsRegularOrGuestSession() const { bool BrowserView::IsRegularOrGuestSession() const {
...@@ -2252,7 +2253,7 @@ base::string16 BrowserView::GetAccessibleWindowTitleForChannelAndProfile( ...@@ -2252,7 +2253,7 @@ base::string16 BrowserView::GetAccessibleWindowTitleForChannelAndProfile(
// Finally annotate with the user - add Incognito or guest if it's an // Finally annotate with the user - add Incognito or guest if it's an
// incognito or guest window, otherwise use the avatar name. // incognito or guest window, otherwise use the avatar name.
ProfileManager* profile_manager = g_browser_process->profile_manager(); ProfileManager* profile_manager = g_browser_process->profile_manager();
if (profile->IsGuestSession()) { if (profile->IsGuestSession() || profile->IsEphemeralGuestProfile()) {
title = l10n_util::GetStringFUTF16(IDS_ACCESSIBLE_GUEST_WINDOW_TITLE_FORMAT, title = l10n_util::GetStringFUTF16(IDS_ACCESSIBLE_GUEST_WINDOW_TITLE_FORMAT,
title); title);
} else if (profile->IsIncognitoProfile()) { } else if (profile->IsIncognitoProfile()) {
......
...@@ -29,7 +29,7 @@ DiceBubbleSyncPromoView::DiceBubbleSyncPromoView( ...@@ -29,7 +29,7 @@ DiceBubbleSyncPromoView::DiceBubbleSyncPromoView(
bool signin_button_prominent, bool signin_button_prominent,
int text_style) int text_style)
: delegate_(delegate) { : delegate_(delegate) {
DCHECK(!profile->IsGuestSession()); DCHECK(!profile->IsGuestSession() && !profile->IsEphemeralGuestProfile());
AccountInfo account; AccountInfo account;
// Signin promos can be shown in incognito, they use an empty account list. // Signin promos can be shown in incognito, they use an empty account list.
if (profile->IsRegularProfile()) if (profile->IsRegularProfile())
......
...@@ -1269,7 +1269,7 @@ void TabStrip::AddTabAt(int model_index, TabRendererData data, bool is_active) { ...@@ -1269,7 +1269,7 @@ void TabStrip::AddTabAt(int model_index, TabRendererData data, bool is_active) {
Profile* profile = controller()->GetProfile(); Profile* profile = controller()->GetProfile();
if (profile) { if (profile) {
if (profile->IsGuestSession()) if (profile->IsGuestSession() || profile->IsEphemeralGuestProfile())
base::UmaHistogramCounts100("Tab.Count.Guest", tab_count()); base::UmaHistogramCounts100("Tab.Count.Guest", tab_count());
else if (profile->IsIncognitoProfile()) else if (profile->IsIncognitoProfile())
base::UmaHistogramCounts100("Tab.Count.Incognito", tab_count()); base::UmaHistogramCounts100("Tab.Count.Incognito", tab_count());
......
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