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

Side by Side Diff: chrome/browser/background_page_tracker.cc

Issue 5730004: Rename ExtensionsService to ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/background_mode_manager.cc ('k') | chrome/browser/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_page_tracker.h" 5 #include "chrome/browser/background_page_tracker.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/background_application_list_model.h" 12 #include "chrome/browser/background_application_list_model.h"
13 #include "chrome/browser/background_contents_service.h" 13 #include "chrome/browser/background_contents_service.h"
14 #include "chrome/browser/background_mode_manager.h" 14 #include "chrome/browser/background_mode_manager.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/extensions/extensions_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/notification_service.h" 22 #include "chrome/common/notification_service.h"
23 #include "chrome/common/notification_type.h" 23 #include "chrome/common/notification_type.h"
24 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 25
26 /////////////////////////////////////////////////////////////////////////////// 26 ///////////////////////////////////////////////////////////////////////////////
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 BackgroundPageTracker::BackgroundPageTracker() { 102 BackgroundPageTracker::BackgroundPageTracker() {
103 // If background mode is disabled, just exit - don't load information from 103 // If background mode is disabled, just exit - don't load information from
104 // prefs or listen for any notifications so we will act as if there are no 104 // prefs or listen for any notifications so we will act as if there are no
105 // background pages, effectively disabling any associated badging. 105 // background pages, effectively disabling any associated badging.
106 if (!IsEnabled()) 106 if (!IsEnabled())
107 return; 107 return;
108 108
109 // Check to make sure all of the extensions are loaded - once they are loaded 109 // Check to make sure all of the extensions are loaded - once they are loaded
110 // we can update the list. 110 // we can update the list.
111 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile(); 111 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile();
112 if (profile->GetExtensionsService() && 112 if (profile->GetExtensionService() &&
113 profile->GetExtensionsService()->is_ready()) { 113 profile->GetExtensionService()->is_ready()) {
114 UpdateExtensionList(); 114 UpdateExtensionList();
115 // We do not send any change notifications here, because the object was 115 // We do not send any change notifications here, because the object was
116 // just created (it doesn't seem appropriate to send a change notification 116 // just created (it doesn't seem appropriate to send a change notification
117 // at initialization time). Also, since this is a singleton object, sending 117 // at initialization time). Also, since this is a singleton object, sending
118 // a notification in the constructor can lead to deadlock if one of the 118 // a notification in the constructor can lead to deadlock if one of the
119 // observers tries to get the singleton. 119 // observers tries to get the singleton.
120 } else { 120 } else {
121 // Extensions aren't loaded yet - register to be notified when they are 121 // Extensions aren't loaded yet - register to be notified when they are
122 // ready. 122 // ready.
123 registrar_.Add(this, NotificationType::EXTENSIONS_READY, 123 registrar_.Add(this, NotificationType::EXTENSIONS_READY,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 break; 170 break;
171 } 171 }
172 default: 172 default:
173 NOTREACHED(); 173 NOTREACHED();
174 } 174 }
175 } 175 }
176 176
177 bool BackgroundPageTracker::UpdateExtensionList() { 177 bool BackgroundPageTracker::UpdateExtensionList() {
178 // Extensions are loaded - update our list. 178 // Extensions are loaded - update our list.
179 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile(); 179 Profile* profile = g_browser_process->profile_manager()->GetDefaultProfile();
180 ExtensionsService* extensions_service = profile->GetExtensionsService(); 180 ExtensionService* extensions_service = profile->GetExtensionService();
181 DCHECK(extensions_service); 181 DCHECK(extensions_service);
182 182
183 // We will make two passes to update the list: 183 // We will make two passes to update the list:
184 // 1) Walk our list, and make sure that there's a corresponding extension for 184 // 1) Walk our list, and make sure that there's a corresponding extension for
185 // each item in the list. If not, delete it (extension was uninstalled). 185 // each item in the list. If not, delete it (extension was uninstalled).
186 // 2) Walk the set of currently loaded extensions and background contents, and 186 // 2) Walk the set of currently loaded extensions and background contents, and
187 // make sure there's an entry in our list for each one. If not, create one. 187 // make sure there's an entry in our list for each one. If not, create one.
188 188
189 PrefService* prefs = GetPrefService(); 189 PrefService* prefs = GetPrefService();
190 std::set<std::string> keys_to_delete; 190 std::set<std::string> keys_to_delete;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 prefs->ScheduleSavePersistentPrefs(); 286 prefs->ScheduleSavePersistentPrefs();
287 SendChangeNotification(); 287 SendChangeNotification();
288 } 288 }
289 289
290 void BackgroundPageTracker::SendChangeNotification() { 290 void BackgroundPageTracker::SendChangeNotification() {
291 NotificationService::current()->Notify( 291 NotificationService::current()->Notify(
292 NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED, 292 NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED,
293 Source<BackgroundPageTracker>(this), 293 Source<BackgroundPageTracker>(this),
294 NotificationService::NoDetails()); 294 NotificationService::NoDetails());
295 } 295 }
OLDNEW
« no previous file with comments | « chrome/browser/background_mode_manager.cc ('k') | chrome/browser/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698