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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
38 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
39 #include "content/public/browser/user_metrics.h" | 39 #include "content/public/browser/user_metrics.h" |
40 #include "grit/chromium_strings.h" | 40 #include "grit/chromium_strings.h" |
41 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
45 | 45 |
46 using content::UserMetricsAction; | 46 using content::UserMetricsAction; |
| 47 using extensions::APIPermission; |
47 using extensions::Extension; | 48 using extensions::Extension; |
48 using extensions::UpdatedExtensionPermissionsInfo; | 49 using extensions::UpdatedExtensionPermissionsInfo; |
49 | 50 |
50 BackgroundModeManager::BackgroundModeData::BackgroundModeData( | 51 BackgroundModeManager::BackgroundModeData::BackgroundModeData( |
51 int command_id, | 52 int command_id, |
52 Profile* profile) | 53 Profile* profile) |
53 : applications_(new BackgroundApplicationListModel(profile)), | 54 : applications_(new BackgroundApplicationListModel(profile)), |
54 command_id_(command_id), | 55 command_id_(command_id), |
55 profile_(profile) { | 56 profile_(profile) { |
56 } | 57 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // treated as new installs. | 310 // treated as new installs. |
310 if (profile->GetExtensionService()->is_ready()) | 311 if (profile->GetExtensionService()->is_ready()) |
311 OnBackgroundAppInstalled(extension); | 312 OnBackgroundAppInstalled(extension); |
312 } | 313 } |
313 } | 314 } |
314 break; | 315 break; |
315 case chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: { | 316 case chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED: { |
316 UpdatedExtensionPermissionsInfo* info = | 317 UpdatedExtensionPermissionsInfo* info = |
317 content::Details<UpdatedExtensionPermissionsInfo>(details).ptr(); | 318 content::Details<UpdatedExtensionPermissionsInfo>(details).ptr(); |
318 if (info->permissions->HasAPIPermission( | 319 if (info->permissions->HasAPIPermission( |
319 ExtensionAPIPermission::kBackground) && | 320 APIPermission::kBackground) && |
320 info->reason == UpdatedExtensionPermissionsInfo::ADDED) { | 321 info->reason == UpdatedExtensionPermissionsInfo::ADDED) { |
321 // Turned on background permission, so treat this as a new install. | 322 // Turned on background permission, so treat this as a new install. |
322 OnBackgroundAppInstalled(info->extension); | 323 OnBackgroundAppInstalled(info->extension); |
323 } | 324 } |
324 } | 325 } |
325 break; | 326 break; |
326 case content::NOTIFICATION_APP_TERMINATING: | 327 case content::NOTIFICATION_APP_TERMINATING: |
327 // Make sure we aren't still keeping the app alive (only happens if we | 328 // Make sure we aren't still keeping the app alive (only happens if we |
328 // don't receive an EXTENSIONS_READY notification for some reason). | 329 // don't receive an EXTENSIONS_READY notification for some reason). |
329 EndKeepAliveForStartup(); | 330 EndKeepAliveForStartup(); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 } | 770 } |
770 } | 771 } |
771 return profile_it; | 772 return profile_it; |
772 } | 773 } |
773 | 774 |
774 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 775 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
775 PrefService* service = g_browser_process->local_state(); | 776 PrefService* service = g_browser_process->local_state(); |
776 DCHECK(service); | 777 DCHECK(service); |
777 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 778 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
778 } | 779 } |
OLD | NEW |