| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/background_application_list_model.h" | 14 #include "chrome/browser/background_application_list_model.h" |
| 15 #include "chrome/browser/background_contents_service.h" | 15 #include "chrome/browser/background_contents_service.h" |
| 16 #include "chrome/browser/background_contents_service_factory.h" |
| 16 #include "chrome/browser/background_mode_manager.h" | 17 #include "chrome/browser/background_mode_manager.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 25 #include "content/common/notification_service.h" | 26 #include "content/common/notification_service.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (!contents->HasKey((*iter)->id())) { | 227 if (!contents->HasKey((*iter)->id())) { |
| 227 contents->SetWithoutPathExpansion( | 228 contents->SetWithoutPathExpansion( |
| 228 (*iter)->id(), Value::CreateBooleanValue(first_launch)); | 229 (*iter)->id(), Value::CreateBooleanValue(first_launch)); |
| 229 pref_modified = true; | 230 pref_modified = true; |
| 230 } | 231 } |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 // Add all apps with background contents also. | 235 // Add all apps with background contents also. |
| 235 BackgroundContentsService* background_contents_service = | 236 BackgroundContentsService* background_contents_service = |
| 236 profile->GetBackgroundContentsService(); | 237 BackgroundContentsServiceFactory::GetForProfile(profile); |
| 237 std::vector<BackgroundContents*> background_contents = | 238 std::vector<BackgroundContents*> background_contents = |
| 238 background_contents_service->GetBackgroundContents(); | 239 background_contents_service->GetBackgroundContents(); |
| 239 for (std::vector<BackgroundContents*>::const_iterator iter = | 240 for (std::vector<BackgroundContents*>::const_iterator iter = |
| 240 background_contents.begin(); | 241 background_contents.begin(); |
| 241 iter != background_contents.end(); | 242 iter != background_contents.end(); |
| 242 ++iter) { | 243 ++iter) { |
| 243 std::string application_id = UTF16ToUTF8( | 244 std::string application_id = UTF16ToUTF8( |
| 244 background_contents_service->GetParentApplicationId(*iter)); | 245 background_contents_service->GetParentApplicationId(*iter)); |
| 245 if (!contents->HasKey(application_id)) { | 246 if (!contents->HasKey(application_id)) { |
| 246 contents->SetWithoutPathExpansion( | 247 contents->SetWithoutPathExpansion( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 prefs->ScheduleSavePersistentPrefs(); | 292 prefs->ScheduleSavePersistentPrefs(); |
| 292 SendChangeNotification(); | 293 SendChangeNotification(); |
| 293 } | 294 } |
| 294 | 295 |
| 295 void BackgroundPageTracker::SendChangeNotification() { | 296 void BackgroundPageTracker::SendChangeNotification() { |
| 296 NotificationService::current()->Notify( | 297 NotificationService::current()->Notify( |
| 297 NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED, | 298 NotificationType::BACKGROUND_PAGE_TRACKER_CHANGED, |
| 298 Source<BackgroundPageTracker>(this), | 299 Source<BackgroundPageTracker>(this), |
| 299 NotificationService::NoDetails()); | 300 NotificationService::NoDetails()); |
| 300 } | 301 } |
| OLD | NEW |