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

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

Issue 460233003: [Win] Fix the size of the themed new avatar button with the new assets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/opaque_browser_frame_view_layout.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profiles_state.h" 8 #include "chrome/browser/profiles/profiles_state.h"
9 #include "chrome/browser/ui/views/profiles/avatar_label.h" 9 #include "chrome/browser/ui/views/profiles/avatar_label.h"
10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 void OpaqueBrowserFrameViewLayout::LayoutNewStyleAvatar(views::View* host) { 380 void OpaqueBrowserFrameViewLayout::LayoutNewStyleAvatar(views::View* host) {
381 DCHECK(switches::IsNewAvatarMenu()); 381 DCHECK(switches::IsNewAvatarMenu());
382 if (!new_avatar_button_) 382 if (!new_avatar_button_)
383 return; 383 return;
384 384
385 gfx::Size label_size = new_avatar_button_->GetPreferredSize(); 385 gfx::Size label_size = new_avatar_button_->GetPreferredSize();
386 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width(); 386 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width();
387 387
388 int button_x = host->width() - trailing_button_start_ - 388 int button_x = host->width() - trailing_button_start_ -
389 button_size_with_offset; 389 button_size_with_offset;
390 int button_y = CaptionButtonY(false); 390 int button_y = CaptionButtonY(!IsTitleBarCondensed());
391 // If the window is maximized, the button is 1 pixel too short. Determined
392 // via visual inspection.
393 int extra_height = IsTitleBarCondensed() ? 1 : 0;
394 391
395 trailing_button_start_ += button_size_with_offset; 392 trailing_button_start_ += button_size_with_offset;
396 minimum_size_for_buttons_ += button_size_with_offset; 393 minimum_size_for_buttons_ += button_size_with_offset;
397 394
395 // |kCaptionButtonHeightWithPadding| adds a 1px padding to the height
msw 2014/08/12 21:22:56 Clarify why the 1px matters or remove the comment
noms (inactive) 2014/08/12 21:44:47 The comment at the top of the file for kCaptionBut
396 // of the button.
398 new_avatar_button_->SetBounds( 397 new_avatar_button_->SetBounds(
399 button_x, 398 button_x,
msw 2014/08/12 21:22:56 nit: move this to the line above, indent others to
noms (inactive) 2014/08/12 21:44:47 Done.
400 button_y, 399 button_y,
401 label_size.width(), 400 label_size.width(),
402 button_y + kCaptionButtonHeightWithPadding + extra_height); 401 kCaptionButtonHeightWithPadding);
403 } 402 }
404 403
405 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) { 404 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) {
406 // Even though the avatar is used for both incognito and profiles we always 405 // Even though the avatar is used for both incognito and profiles we always
407 // use the incognito icon to layout the avatar button. The profile icon 406 // use the incognito icon to layout the avatar button. The profile icon
408 // can be customized so we can't depend on its size to perform layout. 407 // can be customized so we can't depend on its size to perform layout.
409 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon(); 408 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon();
410 409
411 bool avatar_on_right = ShouldAvatarBeOnRight(); 410 bool avatar_on_right = ShouldAvatarBeOnRight();
412 int avatar_bottom = GetTabStripInsetsTop(false) + 411 int avatar_bottom = GetTabStripInsetsTop(false) +
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 684
686 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, 685 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host,
687 views::View* view) { 686 views::View* view) {
688 SetView(view->id(), view); 687 SetView(view->id(), view);
689 } 688 }
690 689
691 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, 690 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host,
692 views::View* view) { 691 views::View* view) {
693 SetView(view->id(), NULL); 692 SetView(view->id(), NULL);
694 } 693 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698