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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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 | Annotate | Revision Log
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Initially set the name for this background mode data. 292 // Initially set the name for this background mode data.
293 size_t index = profile_cache_->GetIndexOfProfileWithPath(profile->GetPath()); 293 size_t index = profile_cache_->GetIndexOfProfileWithPath(profile->GetPath());
294 base::string16 name = l10n_util::GetStringUTF16(IDS_PROFILES_DEFAULT_NAME); 294 base::string16 name = l10n_util::GetStringUTF16(IDS_PROFILES_DEFAULT_NAME);
295 if (index != std::string::npos) 295 if (index != std::string::npos)
296 name = profile_cache_->GetNameOfProfileAtIndex(index); 296 name = profile_cache_->GetNameOfProfileAtIndex(index);
297 bmd->SetName(name); 297 bmd->SetName(name);
298 298
299 // Check for the presence of background apps after all extensions have been 299 // Check for the presence of background apps after all extensions have been
300 // loaded, to handle the case where an extension has been manually removed 300 // loaded, to handle the case where an extension has been manually removed
301 // while Chrome was not running. 301 // while Chrome was not running.
302 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, 302 registrar_.Add(this,
303 extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED,
303 content::Source<Profile>(profile)); 304 content::Source<Profile>(profile));
304 305
305 bmd->applications_->AddObserver(this); 306 bmd->applications_->AddObserver(this);
306 307
307 // If we're adding a new profile and running in multi-profile mode, this new 308 // If we're adding a new profile and running in multi-profile mode, this new
308 // profile should be added to the status icon if one currently exists. 309 // profile should be added to the status icon if one currently exists.
309 if (in_background_mode_ && status_icon_) 310 if (in_background_mode_ && status_icon_)
310 UpdateStatusTrayIconContextMenu(); 311 UpdateStatusTrayIconContextMenu();
311 } 312 }
312 313
(...skipping 12 matching lines...) Expand all
325 return background_mode_data_.size(); 326 return background_mode_data_.size();
326 } 327 }
327 328
328 /////////////////////////////////////////////////////////////////////////////// 329 ///////////////////////////////////////////////////////////////////////////////
329 // BackgroundModeManager, content::NotificationObserver overrides 330 // BackgroundModeManager, content::NotificationObserver overrides
330 void BackgroundModeManager::Observe( 331 void BackgroundModeManager::Observe(
331 int type, 332 int type,
332 const content::NotificationSource& source, 333 const content::NotificationSource& source,
333 const content::NotificationDetails& details) { 334 const content::NotificationDetails& details) {
334 switch (type) { 335 switch (type) {
335 case chrome::NOTIFICATION_EXTENSIONS_READY: 336 case extensions::NOTIFICATION_EXTENSIONS_READY_DEPRECATED:
336 // Extensions are loaded, so we don't need to manually keep the browser 337 // Extensions are loaded, so we don't need to manually keep the browser
337 // process alive any more when running in no-startup-window mode. 338 // process alive any more when running in no-startup-window mode.
338 DecrementKeepAliveCountForStartup(); 339 DecrementKeepAliveCountForStartup();
339 break; 340 break;
340 case chrome::NOTIFICATION_APP_TERMINATING: 341 case chrome::NOTIFICATION_APP_TERMINATING:
341 // Make sure we aren't still keeping the app alive (only happens if we 342 // Make sure we aren't still keeping the app alive (only happens if we
342 // don't receive an EXTENSIONS_READY notification for some reason). 343 // don't receive an EXTENSIONS_READY notification for some reason).
343 DecrementKeepAliveCountForStartup(); 344 DecrementKeepAliveCountForStartup();
344 // Performing an explicit shutdown, so exit background mode (does nothing 345 // Performing an explicit shutdown, so exit background mode (does nothing
345 // if we aren't in background mode currently). 346 // if we aren't in background mode currently).
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 799 }
799 } 800 }
800 return profile_it; 801 return profile_it;
801 } 802 }
802 803
803 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { 804 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const {
804 PrefService* service = g_browser_process->local_state(); 805 PrefService* service = g_browser_process->local_state();
805 DCHECK(service); 806 DCHECK(service);
806 return service->GetBoolean(prefs::kBackgroundModeEnabled); 807 return service->GetBoolean(prefs::kBackgroundModeEnabled);
807 } 808 }
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