OLD | NEW |
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/background/background_application_list_model.h" | 5 #include "chrome/browser/background/background_application_list_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_SERVICE_CHANGED: | 323 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_SERVICE_CHANGED: |
324 Update(); | 324 Update(); |
325 break; | 325 break; |
326 default: | 326 default: |
327 NOTREACHED() << "Received unexpected notification"; | 327 NOTREACHED() << "Received unexpected notification"; |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 void BackgroundApplicationListModel::SendApplicationDataChangedNotifications( | 331 void BackgroundApplicationListModel::SendApplicationDataChangedNotifications( |
332 const Extension* extension) { | 332 const Extension* extension) { |
333 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationDataChanged(extension, | 333 for (auto& observer : observers_) |
334 profile_)); | 334 observer.OnApplicationDataChanged(extension, profile_); |
335 } | 335 } |
336 | 336 |
337 void BackgroundApplicationListModel::OnExtensionLoaded( | 337 void BackgroundApplicationListModel::OnExtensionLoaded( |
338 const Extension* extension) { | 338 const Extension* extension) { |
339 // We only care about extensions that are background applications | 339 // We only care about extensions that are background applications |
340 if (!IsBackgroundApp(*extension, profile_)) | 340 if (!IsBackgroundApp(*extension, profile_)) |
341 return; | 341 return; |
342 AssociateApplicationData(extension); | 342 AssociateApplicationData(extension); |
343 } | 343 } |
344 | 344 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 ExtensionList::const_iterator new_cursor = extensions.begin(); | 391 ExtensionList::const_iterator new_cursor = extensions.begin(); |
392 while (old_cursor != extensions_.end() && | 392 while (old_cursor != extensions_.end() && |
393 new_cursor != extensions.end() && | 393 new_cursor != extensions.end() && |
394 (*old_cursor)->name() == (*new_cursor)->name() && | 394 (*old_cursor)->name() == (*new_cursor)->name() && |
395 (*old_cursor)->id() == (*new_cursor)->id()) { | 395 (*old_cursor)->id() == (*new_cursor)->id()) { |
396 ++old_cursor; | 396 ++old_cursor; |
397 ++new_cursor; | 397 ++new_cursor; |
398 } | 398 } |
399 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 399 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
400 extensions_ = extensions; | 400 extensions_ = extensions; |
401 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 401 for (auto& observer : observers_) |
| 402 observer.OnApplicationListChanged(profile_); |
402 } | 403 } |
403 } | 404 } |
OLD | NEW |