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

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