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

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

Issue 297143008: [Win] UI fixes for the new avatar button/bubble auth errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/new_avatar_button.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 (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/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 client_area_bottom + kClientEdgeThickness - client_area_top), 440 client_area_bottom + kClientEdgeThickness - client_area_top),
441 toolbar_color); 441 toolbar_color);
442 } 442 }
443 443
444 void GlassBrowserFrameView::LayoutNewStyleAvatar() { 444 void GlassBrowserFrameView::LayoutNewStyleAvatar() {
445 DCHECK(switches::IsNewAvatarMenu()); 445 DCHECK(switches::IsNewAvatarMenu());
446 if (!new_avatar_button()) 446 if (!new_avatar_button())
447 return; 447 return;
448 448
449 gfx::Size label_size = new_avatar_button()->GetPreferredSize(); 449 gfx::Size label_size = new_avatar_button()->GetPreferredSize();
450 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width();
451 450
452 int button_x = frame()->GetMinimizeButtonOffset() - 451 int button_x = frame()->GetMinimizeButtonOffset() -
453 kNewAvatarButtonOffset - label_size.width(); 452 kNewAvatarButtonOffset - label_size.width();
454 if (base::i18n::IsRTL()) 453 if (base::i18n::IsRTL())
455 button_x = width() - frame()->GetMinimizeButtonOffset() + 454 button_x = width() - frame()->GetMinimizeButtonOffset() +
456 kNewAvatarButtonOffset; 455 kNewAvatarButtonOffset;
457 int button_y = frame()->IsMaximized() ? NonClientTopBorderHeight() : 1;
458 456
459 // If the window is maximized, the button is 2 pixels too tall. Determined 457 // We need to offset the button correctly in maximized mode, so that the
460 // via visual inspection. 458 // custom glass style aligns with the native control glass style. The
461 int height_to_subtract = frame()->IsMaximized() ? 2 : 0; 459 // glass shadow is off by 1px, which was determined by visual inspection.
460 int button_y = !frame()->IsMaximized() ? 1 :
461 NonClientTopBorderHeight() + kTabstripTopShadowThickness - 1;
462 462
463 new_avatar_button()->SetBounds( 463 new_avatar_button()->SetBounds(
464 button_x, 464 button_x,
465 button_y, 465 button_y,
466 label_size.width(), 466 label_size.width(),
467 button_y + gfx::win::GetSystemMetricsInDIP(SM_CXMENUSIZE) - 467 gfx::win::GetSystemMetricsInDIP(SM_CYMENUSIZE) + 1);
468 height_to_subtract);
469 } 468 }
470 469
471 void GlassBrowserFrameView::LayoutAvatar() { 470 void GlassBrowserFrameView::LayoutAvatar() {
472 // Even though the avatar is used for both incognito and profiles we always 471 // Even though the avatar is used for both incognito and profiles we always
473 // use the incognito icon to layout the avatar button. The profile icon 472 // use the incognito icon to layout the avatar button. The profile icon
474 // can be customized so we can't depend on its size to perform layout. 473 // can be customized so we can't depend on its size to perform layout.
475 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); 474 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon();
476 475
477 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing; 476 int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing;
478 // Move this avatar icon by the size of window controls to prevent it from 477 // Move this avatar icon by the size of window controls to prevent it from
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 static bool initialized = false; 586 static bool initialized = false;
588 if (!initialized) { 587 if (!initialized) {
589 for (int i = 0; i < kThrobberIconCount; ++i) { 588 for (int i = 0; i < kThrobberIconCount; ++i) {
590 throbber_icons_[i] = 589 throbber_icons_[i] =
591 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 590 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
592 DCHECK(throbber_icons_[i]); 591 DCHECK(throbber_icons_[i]);
593 } 592 }
594 initialized = true; 593 initialized = true;
595 } 594 }
596 } 595 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/new_avatar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698