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

Side by Side Diff: components/autofill/core/browser/autofill_driver_factory.cc

Issue 2715483002: Split non-//content parts from ContentAutofillDriverFactory (Closed)
Patch Set: Add instances check Created 3 years, 10 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/core/browser/autofill_driver_factory.h"
6
7 #include "base/callback.h"
8 #include "components/autofill/core/browser/autofill_client.h"
9 #include "components/autofill/core/browser/autofill_driver.h"
10
11 namespace autofill {
12
13 AutofillDriverFactory::AutofillDriverFactory(AutofillClient* client)
14 : client_(client) {}
15
16 AutofillDriverFactory::~AutofillDriverFactory() {}
17
18 AutofillDriver* AutofillDriverFactory::DriverForKey(void* key) {
19 auto mapping = driver_map_.find(key);
20 return mapping == driver_map_.end() ? nullptr : mapping->second.get();
21 }
22
23 void AutofillDriverFactory::AddForKey(
24 void* key,
25 base::Callback<std::unique_ptr<AutofillDriver>()> factory_method) {
26 auto insertion_result = driver_map_.insert(std::make_pair(key, nullptr));
27 // This can be called twice for the key representing the main frame.
28 if (insertion_result.second)
29 insertion_result.first->second = factory_method.Run();
30 }
31
32 void AutofillDriverFactory::DeleteForKey(void* key) {
33 driver_map_.erase(key);
34 }
35
36 void AutofillDriverFactory::NavigationFinished() {
37 client_->HideAutofillPopup();
38 }
39
40 void AutofillDriverFactory::TabHidden() {
41 client_->HideAutofillPopup();
42 }
43
44 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698