diff --git chrome/browser/ui/views/incognito_clear_browsing_data_dialog.cc chrome/browser/ui/views/incognito_clear_browsing_data_dialog.cc index 4569d0afcb80a..5af2fb12f1d7a 100644 --- chrome/browser/ui/views/incognito_clear_browsing_data_dialog.cc +++ chrome/browser/ui/views/incognito_clear_browsing_data_dialog.cc @@ -30,6 +30,9 @@ IncognitoClearBrowsingDataDialog* g_incognito_cbd_dialog = nullptr; void IncognitoClearBrowsingDataDialog::Show(views::View* anchor_view, Profile* incognito_profile, Type type) { + // The full toolbar may not be visible. + if (!anchor_view) + return; g_incognito_cbd_dialog = new IncognitoClearBrowsingDataDialog( anchor_view, incognito_profile, type); views::Widget* const widget = @@ -72,7 +75,9 @@ IncognitoClearBrowsingDataDialog::IncognitoClearBrowsingDataDialog( dialog_type_(type), incognito_profile_(incognito_profile) { DCHECK(incognito_profile_); - DCHECK(incognito_profile_->IsIncognitoProfile()); + DCHECK(incognito_profile_->IsIncognitoProfile() || + (incognito_profile_->IsOffTheRecord() && + incognito_profile_->GetOTRProfileID().IsUniqueForCEF())); SetButtons(ui::DIALOG_BUTTON_NONE); SetShowCloseButton(true); diff --git chrome/browser/ui/views/profiles/incognito_menu_view.cc chrome/browser/ui/views/profiles/incognito_menu_view.cc index 34949452d4891..43aa445b5ac3f 100644 --- chrome/browser/ui/views/profiles/incognito_menu_view.cc +++ chrome/browser/ui/views/profiles/incognito_menu_view.cc @@ -37,7 +37,9 @@ IncognitoMenuView::IncognitoMenuView(views::Button* anchor_button, Browser* browser) : ProfileMenuViewBase(anchor_button, browser) { - DCHECK(browser->profile()->IsIncognitoProfile()); + DCHECK(browser->profile()->IsIncognitoProfile() || + (browser->profile()->IsOffTheRecord() && + browser->profile()->GetOTRProfileID().IsUniqueForCEF())); GetViewAccessibility().OverrideName(GetAccessibleWindowTitle()); base::RecordAction(base::UserMetricsAction("IncognitoMenu_Show")); diff --git chrome/browser/ui/views/profiles/profile_menu_view_base.cc chrome/browser/ui/views/profiles/profile_menu_view_base.cc index 1d4ea0995cbb3..64eba016377da 100644 --- chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc @@ -508,7 +508,9 @@ void ProfileMenuViewBase::ShowBubble(views::Button* anchor_button, feature_engagement::kIPHProfileSwitchFeature); ProfileMenuViewBase* bubble = nullptr; - if (browser->profile()->IsIncognitoProfile()) { + if (browser->profile()->IsIncognitoProfile() || + (browser->profile()->IsOffTheRecord() && + browser->profile()->GetOTRProfileID().IsUniqueForCEF())) { bubble = new IncognitoMenuView(anchor_button, browser); } else { #if BUILDFLAG(IS_CHROMEOS_ASH)