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

Side by Side Diff: chrome/browser/extensions/api/autofill_private/autofill_private_event_router.cc

Issue 2030803002: Fix newly introduced flake in ExtensionPreferenceApiTest.Standard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Ignore any updates before data is loaded. This can happen in tests.
55 if (!(personal_data_ && personal_data_->IsDataLoaded()))
56 return;
55 57
56 autofill_util::AddressEntryList addressList = 58 autofill_util::AddressEntryList addressList =
57 extensions::autofill_util::GenerateAddressList(*personal_data_); 59 extensions::autofill_util::GenerateAddressList(*personal_data_);
58 std::unique_ptr<base::ListValue> args( 60 std::unique_ptr<base::ListValue> args(
59 api::autofill_private::OnAddressListChanged::Create(addressList) 61 api::autofill_private::OnAddressListChanged::Create(addressList)
60 .release()); 62 .release());
61 std::unique_ptr<Event> extension_event( 63 std::unique_ptr<Event> extension_event(
62 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED, 64 new Event(events::AUTOFILL_PRIVATE_ON_ADDRESS_LIST_CHANGED,
63 api::autofill_private::OnAddressListChanged::kEventName, 65 api::autofill_private::OnAddressListChanged::kEventName,
64 std::move(args))); 66 std::move(args)));
(...skipping 10 matching lines...) Expand all
75 std::move(args))); 77 std::move(args)));
76 event_router_->BroadcastEvent(std::move(extension_event)); 78 event_router_->BroadcastEvent(std::move(extension_event));
77 } 79 }
78 80
79 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create( 81 AutofillPrivateEventRouter* AutofillPrivateEventRouter::Create(
80 content::BrowserContext* context) { 82 content::BrowserContext* context) {
81 return new AutofillPrivateEventRouter(context); 83 return new AutofillPrivateEventRouter(context);
82 } 84 }
83 85
84 } // namespace extensions 86 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698