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

Side by Side Diff: chrome/browser/notifications/notifier_state_tracker.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: Header Created 4 years, 3 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
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/notifications/notifier_state_tracker.h" 5 #include "chrome/browser/notifications/notifier_state_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 default: 139 default:
140 NOTREACHED(); 140 NOTREACHED();
141 } 141 }
142 DCHECK(pref_name != NULL); 142 DCHECK(pref_name != NULL);
143 143
144 ListPrefUpdate update(profile_->GetPrefs(), pref_name); 144 ListPrefUpdate update(profile_->GetPrefs(), pref_name);
145 base::ListValue* const list = update.Get(); 145 base::ListValue* const list = update.Get();
146 if (add_new_item) { 146 if (add_new_item) {
147 // AppendIfNotPresent will delete |adding_value| when the same value 147 // AppendIfNotPresent will delete |adding_value| when the same value
148 // already exists. 148 // already exists.
149 list->AppendIfNotPresent(id.release()); 149 list->AppendIfNotPresent(std::move(id));
150 } else { 150 } else {
151 list->Remove(*id, NULL); 151 list->Remove(*id, nullptr);
152 } 152 }
153 } 153 }
154 154
155 void NotifierStateTracker::OnStringListPrefChanged( 155 void NotifierStateTracker::OnStringListPrefChanged(
156 const char* pref_name, std::set<std::string>* ids_field) { 156 const char* pref_name, std::set<std::string>* ids_field) {
157 ids_field->clear(); 157 ids_field->clear();
158 // Separate GetPrefs()->GetList() to analyze the crash. See crbug.com/322320 158 // Separate GetPrefs()->GetList() to analyze the crash. See crbug.com/322320
159 const PrefService* pref_service = profile_->GetPrefs(); 159 const PrefService* pref_service = profile_->GetPrefs();
160 CHECK(pref_service); 160 CHECK(pref_service);
161 const base::ListValue* pref_list = pref_service->GetList(pref_name); 161 const base::ListValue* pref_list = pref_service->GetList(pref_name);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // Tell the IO thread that this extension's permission for notifications 198 // Tell the IO thread that this extension's permission for notifications
199 // has changed. 199 // has changed.
200 extensions::InfoMap* extension_info_map = 200 extensions::InfoMap* extension_info_map =
201 extensions::ExtensionSystem::Get(profile_)->info_map(); 201 extensions::ExtensionSystem::Get(profile_)->info_map();
202 content::BrowserThread::PostTask( 202 content::BrowserThread::PostTask(
203 content::BrowserThread::IO, FROM_HERE, 203 content::BrowserThread::IO, FROM_HERE,
204 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 204 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
205 extension_info_map, notifier_id.id, !enabled)); 205 extension_info_map, notifier_id.id, !enabled));
206 } 206 }
207 #endif 207 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698