| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const EventListenerInfo& details) { | 69 const EventListenerInfo& details) { |
| 70 // Stop listening to events if there are no more listeners. | 70 // Stop listening to events if there are no more listeners. |
| 71 StartOrStopListeningForChanges(); | 71 StartOrStopListeningForChanges(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void AutofillPrivateEventRouter::OnPersonalDataChanged() { | 74 void AutofillPrivateEventRouter::OnPersonalDataChanged() { |
| 75 DCHECK(personal_data_ && personal_data_->IsDataLoaded()); | 75 DCHECK(personal_data_ && personal_data_->IsDataLoaded()); |
| 76 | 76 |
| 77 autofill_util::AddressEntryList addressList = | 77 autofill_util::AddressEntryList addressList = |
| 78 extensions::autofill_util::GenerateAddressList(*personal_data_); | 78 extensions::autofill_util::GenerateAddressList(*personal_data_); |
| 79 scoped_ptr<base::ListValue> args( | 79 std::unique_ptr<base::ListValue> args( |
| 80 api::autofill_private::OnAddressListChanged::Create(addressList) | 80 api::autofill_private::OnAddressListChanged::Create(addressList) |
| 81 .release()); | 81 .release()); |
| 82 scoped_ptr<Event> extension_event( | 82 std::unique_ptr<Event> extension_event( |
| 83 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, | 83 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, |
| 84 api::autofill_private::OnAddressListChanged::kEventName, | 84 api::autofill_private::OnAddressListChanged::kEventName, |
| 85 std::move(args))); | 85 std::move(args))); |
| 86 event_router_->BroadcastEvent(std::move(extension_event)); | 86 event_router_->BroadcastEvent(std::move(extension_event)); |
| 87 | 87 |
| 88 autofill_util::CreditCardEntryList creditCardList = | 88 autofill_util::CreditCardEntryList creditCardList = |
| 89 extensions::autofill_util::GenerateCreditCardList(*personal_data_); | 89 extensions::autofill_util::GenerateCreditCardList(*personal_data_); |
| 90 args.reset( | 90 args.reset( |
| 91 api::autofill_private::OnCreditCardListChanged::Create(creditCardList) | 91 api::autofill_private::OnCreditCardListChanged::Create(creditCardList) |
| 92 .release()); | 92 .release()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 115 | 115 |
| 116 listening_ = should_listen; | 116 listening_ = should_listen; |
| 117 } | 117 } |
| 118 | 118 |
| 119 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( | 119 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( |
| 120 content::BrowserContext* context) { | 120 content::BrowserContext* context) { |
| 121 return new AutofillPrivateEventRouter(context); | 121 return new AutofillPrivateEventRouter(context); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace extensions | 124 } // namespace extensions |
| OLD | NEW |