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

Side by Side Diff: chrome/browser/signin/easy_unlock_service.cc

Issue 1017563003: Hook up AppLifeTimeManager::Observer to turn off discoverability for Smart Lock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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 "chrome/browser/signin/easy_unlock_service.h" 5 #include "chrome/browser/signin/easy_unlock_service.h"
6 6
7 #include "apps/app_lifetime_monitor.h" 7 #include "apps/app_lifetime_monitor.h"
8 #include "apps/app_lifetime_monitor_factory.h" 8 #include "apps/app_lifetime_monitor_factory.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 proximity_auth::switches::kDisableEasyUnlock); 83 proximity_auth::switches::kDisableEasyUnlock);
84 } 84 }
85 85
86 class EasyUnlockService::BluetoothDetector 86 class EasyUnlockService::BluetoothDetector
87 : public device::BluetoothAdapter::Observer, 87 : public device::BluetoothAdapter::Observer,
88 public apps::AppLifetimeMonitor::Observer { 88 public apps::AppLifetimeMonitor::Observer {
89 public: 89 public:
90 explicit BluetoothDetector(EasyUnlockService* service) 90 explicit BluetoothDetector(EasyUnlockService* service)
91 : service_(service), 91 : service_(service),
92 weak_ptr_factory_(this) { 92 weak_ptr_factory_(this) {
93 apps::AppLifetimeMonitorFactory::GetForProfile(service_->profile())
94 ->AddObserver(this);
93 } 95 }
94 96
95 ~BluetoothDetector() override { 97 ~BluetoothDetector() override {
96 if (adapter_.get()) 98 if (adapter_.get())
97 adapter_->RemoveObserver(this); 99 adapter_->RemoveObserver(this);
100 apps::AppLifetimeMonitorFactory::GetForProfile(service_->profile())
101 ->RemoveObserver(this);
98 } 102 }
99 103
100 void Initialize() { 104 void Initialize() {
101 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) 105 if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable())
102 return; 106 return;
103 107
104 device::BluetoothAdapterFactory::GetAdapter( 108 device::BluetoothAdapterFactory::GetAdapter(
105 base::Bind(&BluetoothDetector::OnAdapterInitialized, 109 base::Bind(&BluetoothDetector::OnAdapterInitialized,
106 weak_ptr_factory_.GetWeakPtr())); 110 weak_ptr_factory_.GetWeakPtr()));
107 } 111 }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 799
796 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt 800 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt
797 // failed. 801 // failed.
798 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) 802 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_)
799 ->PrepareTpmKey(true /* check_private_key */, 803 ->PrepareTpmKey(true /* check_private_key */,
800 base::Closure()); 804 base::Closure());
801 #endif // defined(OS_CHROMEOS) 805 #endif // defined(OS_CHROMEOS)
802 806
803 tpm_key_checked_ = true; 807 tpm_key_checked_ = true;
804 } 808 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698