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

Side by Side Diff: components/keyboard_lock/key_hook_activator_collection.cc

Issue 2879033002: Keyboard Lock Host implementation
Patch Set: Remove useless files Created 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/keyboard_lock/key_hook_activator_collection.h"
6
7 #include <utility>
8
9 namespace keyboard_lock {
10
11 KeyHookActivatorCollection::KeyHookActivatorCollection() = default;
12 KeyHookActivatorCollection::~KeyHookActivatorCollection() = default;
13
14 KeyHookActivator* KeyHookActivatorCollection::Find(
15 const content::WebContents* contents) const {
16 DCHECK(thread_checker_.CalledOnValidThread());
17 auto it = activators_.find(contents);
18 if (it == activators_.end()) {
19 return nullptr;
20 }
21 return it->second.get();
22 }
23
24 void KeyHookActivatorCollection::Insert(
25 const content::WebContents* contents,
26 std::unique_ptr<KeyHookActivator> key_hook) {
27 DCHECK(thread_checker_.CalledOnValidThread());
28 auto result = activators_.insert(
29 std::make_pair(contents, std::move(key_hook)));
30 DCHECK(result.second);
31 }
32
33 void KeyHookActivatorCollection::Erase(const content::WebContents* contents) {
34 DCHECK(thread_checker_.CalledOnValidThread());
35 activators_.erase(contents);
36 }
37
38 } // namespace keyboard_lock
OLDNEW
« no previous file with comments | « components/keyboard_lock/key_hook_activator_collection.h ('k') | components/keyboard_lock/key_hook_activator_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698