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

Side by Side Diff: ash/login/ui/lock_contents_view.cc

Issue 2876673002: mojo api for view based lockscreen (Closed)
Patch Set: comment Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/login/ui/lock_contents_view.h" 5 #include "ash/login/ui/lock_contents_view.h"
6 6
7 #include "ash/login/lock_screen_controller.h"
8 #include "ash/session/session_controller.h"
9 #include "ash/shell.h"
7 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
8 #include "ui/views/background.h" 11 #include "ui/views/background.h"
9 #include "ui/views/border.h" 12 #include "ui/views/border.h"
10 #include "ui/views/layout/box_layout.h" 13 #include "ui/views/layout/box_layout.h"
11 14
12 namespace ash { 15 namespace ash {
13 16
14 LockContentsView::LockContentsView() { 17 LockContentsView::LockContentsView() {
15 auto* layout = new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 18 auto* layout = new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
16 SetLayoutManager(layout); 19 SetLayoutManager(layout);
17 20
18 views::Label* label = new views::Label(); 21 views::Label* label = new views::Label();
19 label->SetBorder(views::CreateEmptyBorder(2, 3, 4, 5)); 22 label->SetBorder(views::CreateEmptyBorder(2, 3, 4, 5));
20 label->set_background(views::Background::CreateThemedSolidBackground( 23 label->set_background(views::Background::CreateThemedSolidBackground(
21 label, ui::NativeTheme::kColorId_BubbleBackground)); 24 label, ui::NativeTheme::kColorId_BubbleBackground));
22 label->SetText(base::ASCIIToUTF16("User")); 25 label->SetText(base::ASCIIToUTF16("User"));
23 AddChildView(label); 26 AddChildView(label);
24 27
25 unlock_button_ = 28 unlock_button_ =
26 views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock")); 29 views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock"));
27 AddChildView(unlock_button_); 30 AddChildView(unlock_button_);
28 } 31 }
29 32
30 LockContentsView::~LockContentsView() {} 33 LockContentsView::~LockContentsView() {}
31 34
32 void LockContentsView::ButtonPressed(views::Button* sender, 35 void LockContentsView::ButtonPressed(views::Button* sender,
33 const ui::Event& event) { 36 const ui::Event& event) {
34 DCHECK(unlock_button_ == sender); 37 DCHECK(unlock_button_ == sender);
35 38
36 // TODO: Run mojo call that talks to backend which unlocks the device. 39 // TODO: user index shouldn't be hard coded here. Complete the implementation
37 NOTIMPLEMENTED(); 40 // below.
41 const int kUserIndex = 0;
James Cook 2017/05/15 21:15:00 super nit: When we're using a const local just to
xiaoyinh(OOO Sep 11-29) 2017/05/16 17:32:50 Done.
42 SessionController* session_controller = Shell::Get()->session_controller();
43 const mojom::UserSession* const user_session =
44 session_controller->GetUserSession(kUserIndex);
James Cook 2017/05/15 21:15:00 nit: Just inline the call to Shell::Get()->session
xiaoyinh(OOO Sep 11-29) 2017/05/16 17:32:50 Done.
45 Shell::Get()->lock_screen_controller()->AuthenticateUser(
46 user_session->account_id, std::string(),
47 false /* authenticated_by_pin */);
James Cook 2017/05/15 21:15:00 Thanks for documenting what false means here! It m
38 } 48 }
39 49
40 } // namespace ash 50 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698