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

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

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

Powered by Google App Engine
This is Rietveld 408576698