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

Side by Side Diff: chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.cc

Issue 2236213002: Add quick unlock Settings in options page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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 | « chrome/app/chromeos_strings.grdp ('k') | chrome/browser/resources/options/browser_options.js » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/extensions/quick_unlock_private/quick_unlock_p rivate_api.h" 5 #include "chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_p rivate_api.h"
6 6
7 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" 7 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h"
8 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" 8 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h"
9 #include "chrome/browser/chromeos/profiles/profile_helper.h" 9 #include "chrome/browser/chromeos/profiles/profile_helper.h"
10 #include "chromeos/login/auth/extended_authenticator.h" 10 #include "chromeos/login/auth/extended_authenticator.h"
(...skipping 16 matching lines...) Expand all
27 "|modes| and |credentials| must have the same number of elements"; 27 "|modes| and |credentials| must have the same number of elements";
28 const char kMultipleModesNotSupported[] = 28 const char kMultipleModesNotSupported[] =
29 "At most one quick unlock mode can be active."; 29 "At most one quick unlock mode can be active.";
30 30
31 // Returns the active set of quick unlock modes. 31 // Returns the active set of quick unlock modes.
32 QuickUnlockModeList ComputeActiveModes(Profile* profile) { 32 QuickUnlockModeList ComputeActiveModes(Profile* profile) {
33 QuickUnlockModeList modes; 33 QuickUnlockModeList modes;
34 34
35 chromeos::PinStorage* pin_storage = 35 chromeos::PinStorage* pin_storage =
36 chromeos::PinStorageFactory::GetForProfile(profile); 36 chromeos::PinStorageFactory::GetForProfile(profile);
37 if (pin_storage->IsPinSet()) 37 if (pin_storage && pin_storage->IsPinSet())
38 modes.push_back(quick_unlock_private::QUICK_UNLOCK_MODE_PIN); 38 modes.push_back(quick_unlock_private::QUICK_UNLOCK_MODE_PIN);
39 39
40 return modes; 40 return modes;
41 } 41 }
42 42
43 // Returns true if |a| and |b| contain the same elements. The elements do not 43 // Returns true if |a| and |b| contain the same elements. The elements do not
44 // need to be in the same order. 44 // need to be in the same order.
45 bool AreModesEqual(const QuickUnlockModeList& a, const QuickUnlockModeList& b) { 45 bool AreModesEqual(const QuickUnlockModeList& a, const QuickUnlockModeList& b) {
46 if (a.size() != b.size()) 46 if (a.size() != b.size())
47 return false; 47 return false;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 std::unique_ptr<base::ListValue> args = OnActiveModesChanged::Create(modes); 217 std::unique_ptr<base::ListValue> args = OnActiveModesChanged::Create(modes);
218 std::unique_ptr<Event> event( 218 std::unique_ptr<Event> event(
219 new Event(events::QUICK_UNLOCK_PRIVATE_ON_ACTIVE_MODES_CHANGED, 219 new Event(events::QUICK_UNLOCK_PRIVATE_ON_ACTIVE_MODES_CHANGED,
220 OnActiveModesChanged::kEventName, std::move(args))); 220 OnActiveModesChanged::kEventName, std::move(args)));
221 EventRouter::Get(browser_context())->BroadcastEvent(std::move(event)); 221 EventRouter::Get(browser_context())->BroadcastEvent(std::move(event));
222 } 222 }
223 223
224 } // namespace extensions 224 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/app/chromeos_strings.grdp ('k') | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698