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

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: rebase 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
398 new_avatar_button_->SetBounds( 395 // Do not include the 1px padding that is added for the caption buttons.
399 button_x, 396 new_avatar_button_->SetBounds(button_x,
400 button_y, 397 button_y,
401 label_size.width(), 398 label_size.width(),
402 button_y + kCaptionButtonHeightWithPadding + extra_height); 399 kCaptionButtonHeightWithPadding - 1);
403 } 400 }
404 401
405 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) { 402 void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) {
406 // Even though the avatar is used for both incognito and profiles we always 403 // 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 404 // 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. 405 // can be customized so we can't depend on its size to perform layout.
409 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon(); 406 gfx::ImageSkia incognito_icon = delegate_->GetOTRAvatarIcon();
410 407
411 bool avatar_on_right = ShouldAvatarBeOnRight(); 408 bool avatar_on_right = ShouldAvatarBeOnRight();
412 int avatar_bottom = GetTabStripInsetsTop(false) + 409 int avatar_bottom = GetTabStripInsetsTop(false) +
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 682
686 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host, 683 void OpaqueBrowserFrameViewLayout::ViewAdded(views::View* host,
687 views::View* view) { 684 views::View* view) {
688 SetView(view->id(), view); 685 SetView(view->id(), view);
689 } 686 }
690 687
691 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host, 688 void OpaqueBrowserFrameViewLayout::ViewRemoved(views::View* host,
692 views::View* view) { 689 views::View* view) {
693 SetView(view->id(), NULL); 690 SetView(view->id(), NULL);
694 } 691 }
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