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

Side by Side Diff: components/autofill/content/browser/key_press_handler_manager.cc

Issue 2762233004: Fix autofill popup controller key press callback registration (Closed)
Patch Set: Fixed browsertests Created 3 years, 8 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/autofill/content/browser/key_press_handler_manager.h"
6
7 namespace autofill {
8
9 KeyPressHandlerManager::KeyPressHandlerManager(Delegate* delegate)
10 : delegate_(delegate) {}
11
12 KeyPressHandlerManager::~KeyPressHandlerManager() = default;
13
14 void KeyPressHandlerManager::RegisterKeyPressHandler(
15 const content::RenderWidgetHost::KeyPressEventCallback& handler) {
16 // It would have been nice to be able to tell if two callbacks are just the
17 // same function with the same bound arguments. That's not Equals() does (they
Mathieu 2017/04/05 18:58:21 *what Equals() does
vabr (Chromium) 2017/04/06 05:39:58 Done.
18 // have to have the same BindState), but it's the closest approximation
19 // available.
20 if (handler.is_null() || handler.Equals(handler_))
21 return;
22
23 if (!handler_.is_null())
24 delegate_->RemoveHandler(handler_);
25 handler_ = handler;
26 delegate_->AddHandler(handler_);
27 }
28
29 void KeyPressHandlerManager::RemoveKeyPressHandler() {
30 if (handler_.is_null())
31 return;
32
33 delegate_->RemoveHandler(handler_);
34 handler_.Reset();
35 }
36
37 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698