Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 AutofillPrivateEventRouter::~AutofillPrivateEventRouter() { | 45 AutofillPrivateEventRouter::~AutofillPrivateEventRouter() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AutofillPrivateEventRouter::Shutdown() { | 48 void AutofillPrivateEventRouter::Shutdown() { |
| 49 if (personal_data_) | 49 if (personal_data_) |
| 50 personal_data_->RemoveObserver(this); | 50 personal_data_->RemoveObserver(this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AutofillPrivateEventRouter::OnPersonalDataChanged() { | 53 void AutofillPrivateEventRouter::OnPersonalDataChanged() { |
| 54 DCHECK(personal_data_ && personal_data_->IsDataLoaded()); | 54 DCHECK(personal_data_); |
|
stevenjb
2016/06/08 00:25:53
Looking at personal_data_manager.cc, it is not cle
hcarmona
2016/06/08 14:21:06
Done.
| |
| 55 | |
| 56 // Ignore any updates before data is loaded. This can happen in tests. | |
| 57 if (!personal_data_->IsDataLoaded()) | |
| 58 return; | |
| 55 | 59 |
| 56 autofill_util::AddressEntryList addressList = | 60 autofill_util::AddressEntryList addressList = |
| 57 extensions::autofill_util::GenerateAddressList(*personal_data_); | 61 extensions::autofill_util::GenerateAddressList(*personal_data_); |
| 58 std::unique_ptr<base::ListValue> args( | 62 std::unique_ptr<base::ListValue> args( |
| 59 api::autofill_private::OnAddressListChanged::Create(addressList) | 63 api::autofill_private::OnAddressListChanged::Create(addressList) |
| 60 .release()); | 64 .release()); |
| 61 std::unique_ptr<Event> extension_event( | 65 std::unique_ptr<Event> extension_event( |
| 62 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, | 66 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, |
| 63 api::autofill_private::OnAddressListChanged::kEventName, | 67 api::autofill_private::OnAddressListChanged::kEventName, |
| 64 std::move(args))); | 68 std::move(args))); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 75 std::move(args))); | 79 std::move(args))); |
| 76 event_router_->BroadcastEvent(std::move(extension_event)); | 80 event_router_->BroadcastEvent(std::move(extension_event)); |
| 77 } | 81 } |
| 78 | 82 |
| 79 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( | 83 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( |
| 80 content::BrowserContext* context) { | 84 content::BrowserContext* context) { |
| 81 return new AutofillPrivateEventRouter(context); | 85 return new AutofillPrivateEventRouter(context); |
| 82 } | 86 } |
| 83 | 87 |
| 84 } // namespace extensions | 88 } // namespace extensions |
| OLD | NEW |