| 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/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 // static | 271 // static |
| 272 bool BackgroundApplicationListModel::IsBackgroundApp( | 272 bool BackgroundApplicationListModel::IsBackgroundApp( |
| 273 const Extension& extension, Profile* profile) { | 273 const Extension& extension, Profile* profile) { |
| 274 // An extension is a "background app" if it has the "background API" | 274 // An extension is a "background app" if it has the "background API" |
| 275 // permission, and meets one of the following criteria: | 275 // permission, and meets one of the following criteria: |
| 276 // 1) It is an extension (not a hosted app). | 276 // 1) It is an extension (not a hosted app). |
| 277 // 2) It is a hosted app, and has a background contents registered or in the | 277 // 2) It is a hosted app, and has a background contents registered or in the |
| 278 // manifest. | 278 // manifest. |
| 279 | 279 |
| 280 // Not a background app if we don't have the background permission. | 280 // Not a background app if we don't have the background permission or |
| 281 if (!extension.HasAPIPermission(APIPermission::kBackground)) | 281 // the push messaging permission |
| 282 if (!extension.HasAPIPermission(APIPermission::kBackground) && |
| 283 !extension.HasAPIPermission(APIPermission::kPushMessaging) ) |
| 282 return false; | 284 return false; |
| 283 | 285 |
| 284 // Extensions and packaged apps with background permission are always treated | 286 // Extensions and packaged apps with background permission are always treated |
| 285 // as background apps. | 287 // as background apps. |
| 286 if (!extension.is_hosted_app()) | 288 if (!extension.is_hosted_app()) |
| 287 return true; | 289 return true; |
| 288 | 290 |
| 289 // Hosted apps with manifest-provided background pages are background apps. | 291 // Hosted apps with manifest-provided background pages are background apps. |
| 290 if (extension.has_background_page()) | 292 if (extension.has_background_page()) |
| 291 return true; | 293 return true; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 (*old_cursor)->name() == (*new_cursor)->name() && | 409 (*old_cursor)->name() == (*new_cursor)->name() && |
| 408 (*old_cursor)->id() == (*new_cursor)->id()) { | 410 (*old_cursor)->id() == (*new_cursor)->id()) { |
| 409 ++old_cursor; | 411 ++old_cursor; |
| 410 ++new_cursor; | 412 ++new_cursor; |
| 411 } | 413 } |
| 412 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { | 414 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { |
| 413 extensions_ = extensions; | 415 extensions_ = extensions; |
| 414 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); | 416 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); |
| 415 } | 417 } |
| 416 } | 418 } |
| OLD | NEW |