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

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: fix avatar buttons + redo the bubble warning icon 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
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 kClientEdgeThickness, 439 kClientEdgeThickness,
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 // We need to offset the button correctly in maximized mode, so that the
450 // custom glass style aligns with the native control glass style. Determined
451 // by visual inspection.
452 const int maximized_frame_offset = 7;
msw 2014/06/09 21:42:40 This should probably be determined by some NonClie
noms (inactive) 2014/06/18 18:07:24 Done! I've cleaned up the code a bit too. There's
449 gfx::Size label_size = new_avatar_button()->GetPreferredSize(); 453 gfx::Size label_size = new_avatar_button()->GetPreferredSize();
450 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width(); 454 int button_size_with_offset = kNewAvatarButtonOffset + label_size.width();
451 455
452 int button_x = frame()->GetMinimizeButtonOffset() - 456 int button_x = frame()->GetMinimizeButtonOffset() -
453 kNewAvatarButtonOffset - label_size.width(); 457 kNewAvatarButtonOffset - label_size.width();
454 if (base::i18n::IsRTL()) 458 if (base::i18n::IsRTL())
455 button_x = width() - frame()->GetMinimizeButtonOffset() + 459 button_x = width() - frame()->GetMinimizeButtonOffset() +
456 kNewAvatarButtonOffset; 460 kNewAvatarButtonOffset;
457 int button_y = frame()->IsMaximized() ? NonClientTopBorderHeight() : 1; 461 int button_y = frame()->IsMaximized() ? maximized_frame_offset : 1;
458 462
459 // If the window is maximized, the button is 2 pixels too tall. Determined 463 // If the window is maximized, we need to subtract the previously added
460 // via visual inspection. 464 // offset, plus an extra pixel which makes the button too tall. The latter
461 int height_to_subtract = frame()->IsMaximized() ? 2 : 0; 465 // was determined by visual inspection.
466 int height_to_subtract =
467 frame()->IsMaximized() ? maximized_frame_offset - 1 : 0;
462 468
463 new_avatar_button()->SetBounds( 469 new_avatar_button()->SetBounds(
464 button_x, 470 button_x,
465 button_y, 471 button_y,
466 label_size.width(), 472 label_size.width(),
467 button_y + gfx::win::GetSystemMetricsInDIP(SM_CXMENUSIZE) - 473 button_y + gfx::win::GetSystemMetricsInDIP(SM_CXMENUSIZE) -
468 height_to_subtract); 474 height_to_subtract);
469 } 475 }
470 476
471 void GlassBrowserFrameView::LayoutAvatar() { 477 void GlassBrowserFrameView::LayoutAvatar() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 static bool initialized = false; 593 static bool initialized = false;
588 if (!initialized) { 594 if (!initialized) {
589 for (int i = 0; i < kThrobberIconCount; ++i) { 595 for (int i = 0; i < kThrobberIconCount; ++i) {
590 throbber_icons_[i] = 596 throbber_icons_[i] =
591 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 597 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
592 DCHECK(throbber_icons_[i]); 598 DCHECK(throbber_icons_[i]);
593 } 599 }
594 initialized = true; 600 initialized = true;
595 } 601 }
596 } 602 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698