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

Side by Side Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 576343002: [Easy signin] Add method to get user info to easyUnlockPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win fix Created 6 years, 3 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 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 "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h" 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h"
6 6
7 #include <vector>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/linked_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 13 #include "base/values.h"
11 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ crypto_delegate.h" 14 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ crypto_delegate.h"
12 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 16 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
14 #include "chrome/browser/signin/easy_unlock_service.h" 17 #include "chrome/browser/signin/easy_unlock_service.h"
15 #include "chrome/common/extensions/api/easy_unlock_private.h" 18 #include "chrome/common/extensions/api/easy_unlock_private.h"
16 #include "chrome/grit/generated_resources.h" 19 #include "chrome/grit/generated_resources.h"
17 #include "components/proximity_auth/bluetooth_util.h" 20 #include "components/proximity_auth/bluetooth_util.h"
18 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 EasyUnlockPrivateTrySignInSecretFunction:: 562 EasyUnlockPrivateTrySignInSecretFunction::
560 ~EasyUnlockPrivateTrySignInSecretFunction() { 563 ~EasyUnlockPrivateTrySignInSecretFunction() {
561 } 564 }
562 565
563 bool EasyUnlockPrivateTrySignInSecretFunction::RunAsync() { 566 bool EasyUnlockPrivateTrySignInSecretFunction::RunAsync() {
564 SetError("Not implemented"); 567 SetError("Not implemented");
565 SendResponse(false); 568 SendResponse(false);
566 return true; 569 return true;
567 } 570 }
568 571
572 EasyUnlockPrivateGetUserInfoFunction::EasyUnlockPrivateGetUserInfoFunction() {
573 }
574
575 EasyUnlockPrivateGetUserInfoFunction::~EasyUnlockPrivateGetUserInfoFunction() {
576 }
577
578 bool EasyUnlockPrivateGetUserInfoFunction::RunSync() {
579 EasyUnlockService* service =
580 EasyUnlockService::Get(Profile::FromBrowserContext(browser_context()));
581 std::vector<linked_ptr<easy_unlock_private::UserInfo> > users;
582 std::string user_id = service->GetUserEmail();
583 if (!user_id.empty()) {
584 users.push_back(
585 linked_ptr<easy_unlock_private::UserInfo>(
586 new easy_unlock_private::UserInfo()));
587 users[0]->user_id = user_id;
588 users[0]->logged_in = service->GetType() == EasyUnlockService::TYPE_REGULAR;
589 users[0]->data_ready = service->GetRemoteDevices() != NULL;
590 }
591 results_ = easy_unlock_private::GetUserInfo::Results::Create(users);
592 return true;
593 }
594
569 } // namespace api 595 } // namespace api
570 } // namespace extensions 596 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698