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

Side by Side Diff: ash/system/user/accounts_detailed_view.cc

Issue 253063002: CleanUp: Introduce UserInfo. Move session_state stuff to ash/session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 7 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 | « ash/system/tray/default_system_tray_delegate.cc ('k') | ash/system/user/config.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/system/user/accounts_detailed_view.h" 5 #include "ash/system/user/accounts_detailed_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/multi_profile_uma.h" 9 #include "ash/multi_profile_uma.h"
10 #include "ash/session/user_info.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/tray/fixed_sized_scroll_view.h" 12 #include "ash/system/tray/fixed_sized_scroll_view.h"
12 #include "ash/system/tray/hover_highlight_view.h" 13 #include "ash/system/tray/hover_highlight_view.h"
13 #include "ash/system/tray/system_tray.h" 14 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/system_tray_delegate.h" 15 #include "ash/system/tray/system_tray_delegate.h"
15 #include "ash/system/tray/tray_constants.h" 16 #include "ash/system/tray/tray_constants.h"
16 #include "ash/system/tray/tray_popup_header_button.h" 17 #include "ash/system/tray/tray_popup_header_button.h"
17 #include "ash/system/user/config.h" 18 #include "ash/system/user/config.h"
18 #include "ash/system/user/tray_user.h" 19 #include "ash/system/user/tray_user.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
(...skipping 16 matching lines...) Expand all
36 37
37 } // namespace 38 } // namespace
38 39
39 AccountsDetailedView::AccountsDetailedView(TrayUser* owner, 40 AccountsDetailedView::AccountsDetailedView(TrayUser* owner,
40 user::LoginStatus login_status) 41 user::LoginStatus login_status)
41 : TrayDetailsView(owner), 42 : TrayDetailsView(owner),
42 delegate_(NULL), 43 delegate_(NULL),
43 account_list_(NULL), 44 account_list_(NULL),
44 add_account_button_(NULL), 45 add_account_button_(NULL),
45 add_user_button_(NULL) { 46 add_user_button_(NULL) {
46 std::string user_id = 47 std::string user_id = Shell::GetInstance()
47 Shell::GetInstance()->session_state_delegate()->GetUserID(0); 48 ->session_state_delegate()
49 ->GetUserInfo(0)
50 ->GetUserID();
48 delegate_ = 51 delegate_ =
49 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( 52 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate(
50 user_id); 53 user_id);
51 delegate_->AddObserver(this); 54 delegate_->AddObserver(this);
52 AddHeader(login_status); 55 AddHeader(login_status);
53 CreateScrollableList(); 56 CreateScrollableList();
54 AddAccountList(); 57 AddAccountList();
55 AddAddAccountButton(); 58 AddAddAccountButton();
56 AddFooter(); 59 AddFooter();
57 } 60 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 scroll_content()->AddChildView(account_list_title); 113 scroll_content()->AddChildView(account_list_title);
111 account_list_ = new views::View(); 114 account_list_ = new views::View();
112 UpdateAccountList(); 115 UpdateAccountList();
113 scroll_content()->AddChildView(account_list_); 116 scroll_content()->AddChildView(account_list_);
114 } 117 }
115 118
116 void AccountsDetailedView::AddAddAccountButton() { 119 void AccountsDetailedView::AddAddAccountButton() {
117 SessionStateDelegate* session_state_delegate = 120 SessionStateDelegate* session_state_delegate =
118 Shell::GetInstance()->session_state_delegate(); 121 Shell::GetInstance()->session_state_delegate();
119 HoverHighlightView* add_account_button = new HoverHighlightView(this); 122 HoverHighlightView* add_account_button = new HoverHighlightView(this);
120 base::string16 user_name = session_state_delegate->GetUserGivenName(0); 123 const UserInfo* user_info = session_state_delegate->GetUserInfo(0);
124 base::string16 user_name = user_info->GetGivenName();
121 if (user_name.empty()) 125 if (user_name.empty())
122 user_name = session_state_delegate->GetUserDisplayName(0); 126 user_name = user_info->GetDisplayName();
123 if (user_name.empty()) 127 if (user_name.empty())
124 user_name = base::ASCIIToUTF16(session_state_delegate->GetUserEmail(0)); 128 user_name = base::ASCIIToUTF16(user_info->GetEmail());
125 add_account_button->AddLabel( 129 add_account_button->AddLabel(
126 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_ADD_ACCOUNT_LABEL, 130 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_ADD_ACCOUNT_LABEL,
127 user_name), 131 user_name),
128 gfx::ALIGN_CENTER, 132 gfx::ALIGN_CENTER,
129 gfx::Font::NORMAL); 133 gfx::Font::NORMAL);
130 AddChildView(add_account_button); 134 AddChildView(add_account_button);
131 add_account_button_ = add_account_button; 135 add_account_button_ = add_account_button;
132 } 136 }
133 137
134 void AccountsDetailedView::AddFooter() { 138 void AccountsDetailedView::AddFooter() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 rb.GetImageNamed(IDR_CLOSE_2).ToImageSkia()); 222 rb.GetImageNamed(IDR_CLOSE_2).ToImageSkia());
219 delete_button->SetImage(views::Button::STATE_HOVERED, 223 delete_button->SetImage(views::Button::STATE_HOVERED,
220 rb.GetImageNamed(IDR_CLOSE_2_H).ToImageSkia()); 224 rb.GetImageNamed(IDR_CLOSE_2_H).ToImageSkia());
221 delete_button->SetImage(views::Button::STATE_PRESSED, 225 delete_button->SetImage(views::Button::STATE_PRESSED,
222 rb.GetImageNamed(IDR_CLOSE_2_P).ToImageSkia()); 226 rb.GetImageNamed(IDR_CLOSE_2_P).ToImageSkia());
223 return delete_button; 227 return delete_button;
224 } 228 }
225 229
226 } // namespace tray 230 } // namespace tray
227 } // namespace ash 231 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/default_system_tray_delegate.cc ('k') | ash/system/user/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698