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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 <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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Initially set the name for this background mode data. 269 // Initially set the name for this background mode data.
270 size_t index = profile_cache_->GetIndexOfProfileWithPath(profile->GetPath()); 270 size_t index = profile_cache_->GetIndexOfProfileWithPath(profile->GetPath());
271 base::string16 name = l10n_util::GetStringUTF16(IDS_PROFILES_DEFAULT_NAME); 271 base::string16 name = l10n_util::GetStringUTF16(IDS_PROFILES_DEFAULT_NAME);
272 if (index != std::string::npos) 272 if (index != std::string::npos)
273 name = profile_cache_->GetNameOfProfileAtIndex(index); 273 name = profile_cache_->GetNameOfProfileAtIndex(index);
274 bmd->SetName(name); 274 bmd->SetName(name);
275 275
276 // Listen for when extensions are loaded or add the background permission so 276 // Listen for when extensions are loaded or add the background permission so
277 // we can display a "background app installed" notification and enter 277 // we can display a "background app installed" notification and enter
278 // "launch on login" mode on the Mac. 278 // "launch on login" mode on the Mac.
279 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 279 registrar_.Add(this,
280 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
280 content::Source<Profile>(profile)); 281 content::Source<Profile>(profile));
281 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, 282 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED,
282 content::Source<Profile>(profile)); 283 content::Source<Profile>(profile));
283 284
284 285
285 // Check for the presence of background apps after all extensions have been 286 // Check for the presence of background apps after all extensions have been
286 // loaded, to handle the case where an extension has been manually removed 287 // loaded, to handle the case where an extension has been manually removed
287 // while Chrome was not running. 288 // while Chrome was not running.
288 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 289 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY,
289 content::Source<Profile>(profile)); 290 content::Source<Profile>(profile));
(...skipping 27 matching lines...) Expand all
317 int type, 318 int type,
318 const content::NotificationSource& source, 319 const content::NotificationSource& source,
319 const content::NotificationDetails& details) { 320 const content::NotificationDetails& details) {
320 switch (type) { 321 switch (type) {
321 case chrome::NOTIFICATION_EXTENSIONS_READY: 322 case chrome::NOTIFICATION_EXTENSIONS_READY:
322 // Extensions are loaded, so we don't need to manually keep the browser 323 // Extensions are loaded, so we don't need to manually keep the browser
323 // process alive any more when running in no-startup-window mode. 324 // process alive any more when running in no-startup-window mode.
324 DecrementKeepAliveCountForStartup(); 325 DecrementKeepAliveCountForStartup();
325 break; 326 break;
326 327
327 case chrome::NOTIFICATION_EXTENSION_LOADED: { 328 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: {
328 Extension* extension = content::Details<Extension>(details).ptr(); 329 Extension* extension = content::Details<Extension>(details).ptr();
329 Profile* profile = content::Source<Profile>(source).ptr(); 330 Profile* profile = content::Source<Profile>(source).ptr();
330 if (BackgroundApplicationListModel::IsBackgroundApp( 331 if (BackgroundApplicationListModel::IsBackgroundApp(
331 *extension, profile)) { 332 *extension, profile)) {
332 // Extensions loaded after the ExtensionsService is ready should be 333 // Extensions loaded after the ExtensionsService is ready should be
333 // treated as new installs. 334 // treated as new installs.
334 if (extensions::ExtensionSystem::Get(profile)->extension_service()-> 335 if (extensions::ExtensionSystem::Get(profile)->extension_service()->
335 is_ready()) { 336 is_ready()) {
336 bool is_being_reloaded = false; 337 bool is_being_reloaded = false;
337 CheckReloadStatus(extension, &is_being_reloaded); 338 CheckReloadStatus(extension, &is_being_reloaded);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 823 }
823 } 824 }
824 return profile_it; 825 return profile_it;
825 } 826 }
826 827
827 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { 828 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const {
828 PrefService* service = g_browser_process->local_state(); 829 PrefService* service = g_browser_process->local_state();
829 DCHECK(service); 830 DCHECK(service);
830 return service->GetBoolean(prefs::kBackgroundModeEnabled); 831 return service->GetBoolean(prefs::kBackgroundModeEnabled);
831 } 832 }
OLDNEW
« no previous file with comments | « chrome/browser/background/background_contents_service.cc ('k') | chrome/browser/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698