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

Side by Side Diff: chrome/browser/background/background_application_list_model.cc

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review, Devlin review. Created 5 years 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/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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
14 #include "chrome/browser/background/background_contents_service.h" 14 #include "chrome/browser/background/background_contents_service.h"
15 #include "chrome/browser/background/background_contents_service_factory.h" 15 #include "chrome/browser/background/background_contents_service_factory.h"
16 #include "chrome/browser/background/background_mode_manager.h" 16 #include "chrome/browser/background/background_mode_manager.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "components/crx_file/id_util.h" 22 #include "components/crx_file/id_util.h"
23 #include "content/public/browser/notification_details.h" 23 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
25 #include "extensions/browser/extension_prefs.h" 25 #include "extensions/browser/extension_prefs.h"
26 #include "extensions/browser/extension_registry.h" 26 #include "extensions/browser/extension_registry.h"
27 #include "extensions/browser/extension_system.h" 27 #include "extensions/browser/extension_system.h"
28 #include "extensions/browser/extension_util.h"
29 #include "extensions/browser/image_loader.h" 28 #include "extensions/browser/image_loader.h"
30 #include "extensions/browser/notification_types.h" 29 #include "extensions/browser/notification_types.h"
31 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
32 #include "extensions/common/extension_icon_set.h" 31 #include "extensions/common/extension_icon_set.h"
33 #include "extensions/common/extension_resource.h" 32 #include "extensions/common/extension_resource.h"
34 #include "extensions/common/extension_set.h" 33 #include "extensions/common/extension_set.h"
35 #include "extensions/common/manifest_handlers/background_info.h" 34 #include "extensions/common/manifest_handlers/background_info.h"
36 #include "extensions/common/manifest_handlers/icons_handler.h" 35 #include "extensions/common/manifest_handlers/icons_handler.h"
37 #include "extensions/common/permissions/permission_set.h" 36 #include "extensions/common/permissions/permission_set.h"
38 #include "extensions/common/permissions/permissions_data.h" 37 #include "extensions/common/permissions/permissions_data.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 256
258 // static 257 // static
259 bool BackgroundApplicationListModel::IsBackgroundApp( 258 bool BackgroundApplicationListModel::IsBackgroundApp(
260 const Extension& extension, Profile* profile) { 259 const Extension& extension, Profile* profile) {
261 // An extension is a "background app" if it has the "background API" 260 // An extension is a "background app" if it has the "background API"
262 // permission, and meets one of the following criteria: 261 // permission, and meets one of the following criteria:
263 // 1) It is an extension (not a hosted app). 262 // 1) It is an extension (not a hosted app).
264 // 2) It is a hosted app, and has a background contents registered or in the 263 // 2) It is a hosted app, and has a background contents registered or in the
265 // manifest. 264 // manifest.
266 265
267 // Ephemeral apps are denied any background activity after their event page
268 // has been destroyed, thus they cannot be background apps.
269 if (extensions::util::IsEphemeralApp(extension.id(), profile))
270 return false;
271
272 // Not a background app if we don't have the background permission. 266 // Not a background app if we don't have the background permission.
273 if (!extension.permissions_data()->HasAPIPermission( 267 if (!extension.permissions_data()->HasAPIPermission(
274 APIPermission::kBackground)) { 268 APIPermission::kBackground)) {
275 return false; 269 return false;
276 } 270 }
277 271
278 // Extensions and packaged apps with background permission are always treated 272 // Extensions and packaged apps with background permission are always treated
279 // as background apps. 273 // as background apps.
280 if (!extension.is_hosted_app()) 274 if (!extension.is_hosted_app())
281 return true; 275 return true;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 (*old_cursor)->name() == (*new_cursor)->name() && 398 (*old_cursor)->name() == (*new_cursor)->name() &&
405 (*old_cursor)->id() == (*new_cursor)->id()) { 399 (*old_cursor)->id() == (*new_cursor)->id()) {
406 ++old_cursor; 400 ++old_cursor;
407 ++new_cursor; 401 ++new_cursor;
408 } 402 }
409 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) { 403 if (old_cursor != extensions_.end() || new_cursor != extensions.end()) {
410 extensions_ = extensions; 404 extensions_ = extensions;
411 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_)); 405 FOR_EACH_OBSERVER(Observer, observers_, OnApplicationListChanged(profile_));
412 } 406 }
413 } 407 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/shortcut_manager.cc ('k') | chrome/browser/background/background_application_list_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698