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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_store.cc

Issue 2422963002: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/extensions (Closed)
Patch Set: extensions Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/content_settings/content_settings_store. h" 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store. h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 void ContentSettingsStore::RemoveObserver(Observer* observer) { 350 void ContentSettingsStore::RemoveObserver(Observer* observer) {
351 DCHECK(OnCorrectThread()); 351 DCHECK(OnCorrectThread());
352 observers_.RemoveObserver(observer); 352 observers_.RemoveObserver(observer);
353 } 353 }
354 354
355 void ContentSettingsStore::NotifyOfContentSettingChanged( 355 void ContentSettingsStore::NotifyOfContentSettingChanged(
356 const std::string& extension_id, 356 const std::string& extension_id,
357 bool incognito) { 357 bool incognito) {
358 FOR_EACH_OBSERVER( 358 for (auto& observer : observers_)
359 ContentSettingsStore::Observer, 359 observer.OnContentSettingChanged(extension_id, incognito);
360 observers_,
361 OnContentSettingChanged(extension_id, incognito));
362 } 360 }
363 361
364 bool ContentSettingsStore::OnCorrectThread() { 362 bool ContentSettingsStore::OnCorrectThread() {
365 // If there is no UI thread, we're most likely in a unit test. 363 // If there is no UI thread, we're most likely in a unit test.
366 return !BrowserThread::IsThreadInitialized(BrowserThread::UI) || 364 return !BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
367 BrowserThread::CurrentlyOn(BrowserThread::UI); 365 BrowserThread::CurrentlyOn(BrowserThread::UI);
368 } 366 }
369 367
370 ContentSettingsStore::ExtensionEntryMap::iterator 368 ContentSettingsStore::ExtensionEntryMap::iterator
371 ContentSettingsStore::FindEntry(const std::string& ext_id) { 369 ContentSettingsStore::FindEntry(const std::string& ext_id) {
372 ExtensionEntryMap::iterator i; 370 ExtensionEntryMap::iterator i;
373 for (i = entries_.begin(); i != entries_.end(); ++i) { 371 for (i = entries_.begin(); i != entries_.end(); ++i) {
374 if (i->second->id == ext_id) 372 if (i->second->id == ext_id)
375 return i; 373 return i;
376 } 374 }
377 return entries_.end(); 375 return entries_.end();
378 } 376 }
379 377
380 ContentSettingsStore::ExtensionEntryMap::const_iterator 378 ContentSettingsStore::ExtensionEntryMap::const_iterator
381 ContentSettingsStore::FindEntry(const std::string& ext_id) const { 379 ContentSettingsStore::FindEntry(const std::string& ext_id) const {
382 ExtensionEntryMap::const_iterator i; 380 ExtensionEntryMap::const_iterator i;
383 for (i = entries_.begin(); i != entries_.end(); ++i) { 381 for (i = entries_.begin(); i != entries_.end(); ++i) {
384 if (i->second->id == ext_id) 382 if (i->second->id == ext_id)
385 return i; 383 return i;
386 } 384 }
387 return entries_.end(); 385 return entries_.end();
388 } 386 }
389 387
390 } // namespace extensions 388 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.cc ('k') | chrome/browser/extensions/api/dial/dial_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698