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

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc

Issue 127253004: Support displaying the avatar label on the right side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
index 982bdf38c8be2e9aec068f98824399bf94e03035..8492566ad48aff43685f5b36b23b355de899a0f6 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
#include "chrome/browser/profiles/profiles_state.h"
+#include "chrome/browser/ui/views/avatar_label.h"
#include "chrome/browser/ui/views/avatar_menu_button.h"
#include "chrome/common/profile_management_switches.h"
#include "ui/gfx/font.h"
@@ -431,15 +432,18 @@ void OpaqueBrowserFrameViewLayout::LayoutAvatar(views::View* host) {
int edge_offset;
if (avatar_label_) {
+ avatar_label_->SetLabelOnRight(avatar_on_right);
// Space between the bottom of the avatar and the bottom of the avatar
// label.
const int kAvatarLabelBottomSpacing = 3;
gfx::Size label_size = avatar_label_->GetPreferredSize();
- // The x-position of the avatar label should be slightly to the left of
- // the avatar menu button. Therefore we use the |leading_button_start_|
- // value directly.
+ // The outside edge of the avatar label should be just outside that of the
+ // avatar menu button.
+ int avatar_label_x = avatar_on_right ?
+ host->width() - trailing_button_start_ - label_size.width() :
Peter Kasting 2014/01/16 21:46:17 Nit: Consider parens around this subexpression
Adrian Kuegel 2014/01/17 09:42:17 Done.
+ leading_button_start_;
gfx::Rect label_bounds(
- leading_button_start_,
+ avatar_label_x,
avatar_bottom - kAvatarLabelBottomSpacing - label_size.height(),
label_size.width(),
delegate_->ShouldShowAvatar() ? label_size.height() : 0);
@@ -626,7 +630,7 @@ void OpaqueBrowserFrameViewLayout::SetView(int id, views::View* view) {
window_title_ = static_cast<views::Label*>(view);
break;
case VIEW_ID_AVATAR_LABEL:
- avatar_label_ = view;
+ avatar_label_ = static_cast<AvatarLabel*>(view);
break;
case VIEW_ID_AVATAR_BUTTON:
if (view) {

Powered by Google App Engine
This is Rietveld 408576698