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: ash/common/system/user/user_card_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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 | « ash/common/system/user/tray_user.cc ('k') | ash/common/system/user/user_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/common/system/user/user_card_view.h" 5 #include "ash/common/system/user/user_card_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/login_status.h" 10 #include "ash/common/login_status.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 .GetImageNamed(IDR_AURA_UBER_TRAY_GUEST_ICON) 75 .GetImageNamed(IDR_AURA_UBER_TRAY_GUEST_ICON)
76 .ToImageSkia(); 76 .ToImageSkia();
77 image_view->SetImage(icon, icon.size()); 77 image_view->SetImage(icon, icon.size());
78 } else { 78 } else {
79 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); 79 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
80 image_view->SetImage(delegate->GetUserInfo(user_index)->GetImage(), 80 image_view->SetImage(delegate->GetUserInfo(user_index)->GetImage(),
81 gfx::Size(kTrayItemSize, kTrayItemSize)); 81 gfx::Size(kTrayItemSize, kTrayItemSize));
82 } 82 }
83 83
84 if (UseMd()) { 84 if (UseMd()) {
85 image_view->SetBorder(views::Border::CreateEmptyBorder(gfx::Insets( 85 image_view->SetBorder(views::CreateEmptyBorder(gfx::Insets(
86 (GetTrayConstant(TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH) - 86 (GetTrayConstant(TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH) -
87 image_view->GetPreferredSize().width()) / 87 image_view->GetPreferredSize().width()) /
88 2))); 88 2)));
89 } 89 }
90 return image_view; 90 return image_view;
91 } 91 }
92 92
93 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
94 class MediaIndicator : public views::View, public MediaCaptureObserver { 94 class MediaIndicator : public views::View, public MediaCaptureObserver {
95 public: 95 public:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 ScopedVector<gfx::RenderText> lines_; 179 ScopedVector<gfx::RenderText> lines_;
180 180
181 DISALLOW_COPY_AND_ASSIGN(PublicAccountUserDetails); 181 DISALLOW_COPY_AND_ASSIGN(PublicAccountUserDetails);
182 }; 182 };
183 183
184 PublicAccountUserDetails::PublicAccountUserDetails(int max_width) 184 PublicAccountUserDetails::PublicAccountUserDetails(int max_width)
185 : learn_more_(NULL) { 185 : learn_more_(NULL) {
186 const int inner_padding = 186 const int inner_padding =
187 kTrayPopupPaddingHorizontal - kTrayPopupPaddingBetweenItems; 187 kTrayPopupPaddingHorizontal - kTrayPopupPaddingBetweenItems;
188 const bool rtl = base::i18n::IsRTL(); 188 const bool rtl = base::i18n::IsRTL();
189 SetBorder(views::Border::CreateEmptyBorder( 189 SetBorder(views::CreateEmptyBorder(
190 kUserDetailsVerticalPadding, rtl ? 0 : inner_padding, 190 kUserDetailsVerticalPadding, rtl ? 0 : inner_padding,
191 kUserDetailsVerticalPadding, rtl ? inner_padding : 0)); 191 kUserDetailsVerticalPadding, rtl ? inner_padding : 0));
192 192
193 // Retrieve the user's display name and wrap it with markers. 193 // Retrieve the user's display name and wrap it with markers.
194 // Note that since this is a public account it always has to be the primary 194 // Note that since this is a public account it always has to be the primary
195 // user. 195 // user.
196 base::string16 display_name = WmShell::Get() 196 base::string16 display_name = WmShell::Get()
197 ->GetSessionStateDelegate() 197 ->GetSessionStateDelegate()
198 ->GetUserInfo(0) 198 ->GetUserInfo(0)
199 ->GetDisplayName(); 199 ->GetDisplayName();
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 #else 472 #else
473 AddChildView(user_email); 473 AddChildView(user_email);
474 #endif 474 #endif
475 } 475 }
476 } 476 }
477 } 477 }
478 478
479 479
480 } // namespace tray 480 } // namespace tray
481 } // namespace ash 481 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/tray_user.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698