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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view.cc

Issue 2893343002: Resize avatar button as appropriate for opaque browser frame. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/app/vector_icons/vector_icons.h" 8 #include "chrome/app/vector_icons/vector_icons.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/avatar_menu.h" 10 #include "chrome/browser/profiles/avatar_menu.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 : ThemeProperties::GetDefaultColor( 64 : ThemeProperties::GetDefaultColor(
65 color_id, browser_view_->IsIncognito()); 65 color_id, browser_view_->IsIncognito());
66 } 66 }
67 67
68 views::View* BrowserNonClientFrameView::GetProfileSwitcherView() const { 68 views::View* BrowserNonClientFrameView::GetProfileSwitcherView() const {
69 return nullptr; 69 return nullptr;
70 } 70 }
71 71
72 void BrowserNonClientFrameView::UpdateClientArea() {} 72 void BrowserNonClientFrameView::UpdateClientArea() {}
73 73
74 void BrowserNonClientFrameView::ChildPreferredSizeChanged(views::View* child) {
75 if (child == GetProfileSwitcherView()) {
76 // Need to layout the root view here, too, as the avatar button may change
Peter Kasting 2017/05/22 18:44:14 Nit: Not clear what "here, too," means in this con
Evan Stade 2017/05/22 20:32:48 Done.
77 // between the text and the icon when a profile is added or removed, which
78 // changes its width. This may cause it to start or stop overlapping the
79 // the tabstrip horizontally, which in turn causes it to change height, as
80 // calculated in LayoutProfileSwitcher(). Calling LayoutProfileSwitcher()
Peter Kasting 2017/05/22 18:44:15 Nit: LayoutProfileSwitcher() is not a member of th
Evan Stade 2017/05/22 20:32:48 I replaced this comment with the one we used to ha
81 // is not enough here - it does not re-draw the line below the tabstrip
82 // properly when a profile is added or removed. Even adding
83 // browser_view()->tabstrip()->Layout() and SchedulePaint() is not enough.
84 // TODO(bsep): Figure out the most efficient way to do this.
85 frame()->GetRootView()->Layout();
86 }
87 }
88
74 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, 89 void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from,
75 bool is_visible) { 90 bool is_visible) {
76 // UpdateTaskbarDecoration() calls DrawTaskbarDecoration(), but that does 91 // UpdateTaskbarDecoration() calls DrawTaskbarDecoration(), but that does
77 // nothing if the window is not visible. So even if we've already gotten the 92 // nothing if the window is not visible. So even if we've already gotten the
78 // up-to-date decoration, we need to run the update procedure again here when 93 // up-to-date decoration, we need to run the update procedure again here when
79 // the window becomes visible. 94 // the window becomes visible.
80 if (is_visible) 95 if (is_visible)
81 OnProfileAvatarChanged(base::FilePath()); 96 OnProfileAvatarChanged(base::FilePath());
82 } 97 }
83 98
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // safety. See crbug.com/313800. 286 // safety. See crbug.com/313800.
272 gfx::Image decoration; 287 gfx::Image decoration;
273 AvatarMenu::GetImageForMenuButton( 288 AvatarMenu::GetImageForMenuButton(
274 browser_view()->browser()->profile()->GetPath(), &decoration); 289 browser_view()->browser()->profile()->GetPath(), &decoration);
275 // This can happen if the user deletes the current profile. 290 // This can happen if the user deletes the current profile.
276 if (decoration.IsEmpty()) 291 if (decoration.IsEmpty())
277 return; 292 return;
278 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration); 293 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), &decoration);
279 #endif 294 #endif
280 } 295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698