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 "chrome/browser/background/background_contents_service.h" | 5 #include "chrome/browser/background/background_contents_service.h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // <appid_1>: { "url": <url1>, "name": <frame_name> }, | 246 // <appid_1>: { "url": <url1>, "name": <frame_name> }, |
247 // <appid_2>: { "url": <url2>, "name": <frame_name> }, | 247 // <appid_2>: { "url": <url2>, "name": <frame_name> }, |
248 // ... etc ... | 248 // ... etc ... |
249 // } | 249 // } |
250 const char kUrlKey[] = "url"; | 250 const char kUrlKey[] = "url"; |
251 const char kFrameNameKey[] = "name"; | 251 const char kFrameNameKey[] = "name"; |
252 | 252 |
253 int BackgroundContentsService::restart_delay_in_ms_ = 3000; // 3 seconds. | 253 int BackgroundContentsService::restart_delay_in_ms_ = 3000; // 3 seconds. |
254 | 254 |
255 BackgroundContentsService::BackgroundContentsService( | 255 BackgroundContentsService::BackgroundContentsService( |
256 Profile* profile, const CommandLine* command_line) | 256 Profile* profile, |
| 257 const base::CommandLine* command_line) |
257 : prefs_(NULL), extension_registry_observer_(this) { | 258 : prefs_(NULL), extension_registry_observer_(this) { |
258 // Don't load/store preferences if the parent profile is incognito. | 259 // Don't load/store preferences if the parent profile is incognito. |
259 if (!profile->IsOffTheRecord()) | 260 if (!profile->IsOffTheRecord()) |
260 prefs_ = profile->GetPrefs(); | 261 prefs_ = profile->GetPrefs(); |
261 | 262 |
262 // Listen for events to tell us when to load/unload persisted background | 263 // Listen for events to tell us when to load/unload persisted background |
263 // contents. | 264 // contents. |
264 StartObserving(profile); | 265 StartObserving(profile); |
265 } | 266 } |
266 | 267 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 bool user_gesture, | 771 bool user_gesture, |
771 bool* was_blocked) { | 772 bool* was_blocked) { |
772 Browser* browser = chrome::FindLastActiveWithProfile( | 773 Browser* browser = chrome::FindLastActiveWithProfile( |
773 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 774 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
774 chrome::GetActiveDesktop()); | 775 chrome::GetActiveDesktop()); |
775 if (browser) { | 776 if (browser) { |
776 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 777 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
777 initial_pos, user_gesture, was_blocked); | 778 initial_pos, user_gesture, was_blocked); |
778 } | 779 } |
779 } | 780 } |
OLD | NEW |