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 63bdd68028f622ce28b066ace4f3e3f8290ba2cc..8d32d1125d5d665a456ff2b7b0cbe4dec445c5a4 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 |
@@ -6,6 +6,7 @@ |
#include "base/command_line.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/chrome_switches.h" |
#include "chrome/common/profile_management_switches.h" |
@@ -446,15 +447,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()) : |
+ 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); |
@@ -641,7 +645,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) { |