Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2918)

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 1785643002: Update avatar icon when nonclient frame view is added to view hierarchy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More consistent calling of GetNativeWindow() Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index e4d7e800d4d6166fa83cfeca064300b1250c94bd..69a580a575f483d4912c9cd781f1c05f143d0232 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -627,13 +627,7 @@ bool BrowserView::ShouldShowAvatar() const {
// Don't show incognito avatar in the guest session.
if (IsOffTheRecord() && !IsGuestSession())
return true;
- // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo
- // during the creation of the BrowserWindow, so browser->window() will not
- // yet be set. In this case we can safely return false.
- if (!browser_->window())
- return false;
- return chrome::MultiUserWindowManager::ShouldShowAvatar(
- browser_->window()->GetNativeWindow());
+ return chrome::MultiUserWindowManager::ShouldShowAvatar(GetNativeWindow());
#else
if (!IsBrowserTypeNormal())
return false;
@@ -771,11 +765,8 @@ void BrowserView::SetAlwaysOnTop(bool always_on_top) {
gfx::NativeWindow BrowserView::GetNativeWindow() const {
// While the browser destruction is going on, the widget can already be gone,
- // but utility functions like FindBrowserWithWindow will come here and crash.
- // We short circuit therefore.
- if (!GetWidget())
- return nullptr;
- return GetWidget()->GetTopLevelWidget()->GetNativeWindow();
+ // but utility functions like FindBrowserWithWindow will still call this.
+ return GetWidget() ? GetWidget()->GetNativeWindow() : nullptr;
}
StatusBubble* BrowserView::GetStatusBubble() {
@@ -1257,12 +1248,11 @@ gfx::Rect BrowserView::GetRootWindowResizerRect() const {
void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url,
Profile* profile) {
- chrome::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url,
- nullptr, profile);
+ chrome::EditSearchEngine(GetNativeWindow(), template_url, nullptr, profile);
}
void BrowserView::ShowUpdateChromeDialog() {
- UpdateRecommendedMessageBox::Show(GetWidget()->GetNativeWindow());
+ UpdateRecommendedMessageBox::Show(GetNativeWindow());
}
void BrowserView::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) {

Powered by Google App Engine
This is Rietveld 408576698