OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/autofill_private/autofill_private_event_
router.h" | 5 #include "chrome/browser/extensions/api/autofill_private/autofill_private_event_
router.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 13 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/extensions/api/autofill_private/autofill_util.h" | 15 #include "chrome/browser/extensions/api/autofill_private/autofill_util.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
18 #include "chrome/common/extensions/api/autofill_private.h" | 18 #include "chrome/common/extensions/api/autofill_private.h" |
19 #include "components/autofill/core/browser/personal_data_manager.h" | 19 #include "components/autofill/core/browser/personal_data_manager.h" |
20 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 AutofillPrivateEventRouter::AutofillPrivateEventRouter( | 24 AutofillPrivateEventRouter::AutofillPrivateEventRouter( |
25 content::BrowserContext* context) | 25 content::BrowserContext* context) |
26 : context_(context), | 26 : context_(context), |
27 event_router_(nullptr), | 27 event_router_(nullptr), |
28 personal_data_(nullptr) { | 28 personal_data_(nullptr), |
| 29 listening_(false) { |
29 // Register with the event router so we know when renderers are listening to | 30 // Register with the event router so we know when renderers are listening to |
30 // our events. We first check and see if there *is* an event router, because | 31 // our events. We first check and see if there *is* an event router, because |
31 // some unit tests try to create all context services, but don't initialize | 32 // some unit tests try to create all context services, but don't initialize |
32 // the event router first. | 33 // the event router first. |
33 event_router_ = EventRouter::Get(context_); | 34 event_router_ = EventRouter::Get(context_); |
34 if (!event_router_) | 35 if (!event_router_) |
35 return; | 36 return; |
36 | 37 |
37 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( | 38 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( |
38 Profile::FromBrowserContext(context_)); | 39 Profile::FromBrowserContext(context_)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 std::move(args))); | 76 std::move(args))); |
76 event_router_->BroadcastEvent(std::move(extension_event)); | 77 event_router_->BroadcastEvent(std::move(extension_event)); |
77 } | 78 } |
78 | 79 |
79 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( | 80 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( |
80 content::BrowserContext* context) { | 81 content::BrowserContext* context) { |
81 return new AutofillPrivateEventRouter(context); | 82 return new AutofillPrivateEventRouter(context); |
82 } | 83 } |
83 | 84 |
84 } // namespace extensions | 85 } // namespace extensions |
OLD | NEW |