OLD | NEW |
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_contents_service.h" | 5 #include "chrome/browser/background_contents_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // } | 37 // } |
38 const char kUrlKey[] = "url"; | 38 const char kUrlKey[] = "url"; |
39 const char kFrameNameKey[] = "name"; | 39 const char kFrameNameKey[] = "name"; |
40 | 40 |
41 BackgroundContentsService::BackgroundContentsService( | 41 BackgroundContentsService::BackgroundContentsService( |
42 Profile* profile, const CommandLine* command_line) | 42 Profile* profile, const CommandLine* command_line) |
43 : prefs_(NULL) { | 43 : prefs_(NULL) { |
44 // Don't load/store preferences if the proper switch is not enabled, or if | 44 // Don't load/store preferences if the proper switch is not enabled, or if |
45 // the parent profile is off the record. | 45 // the parent profile is off the record. |
46 if (!profile->IsOffTheRecord() && | 46 if (!profile->IsOffTheRecord() && |
47 command_line->HasSwitch(switches::kRestoreBackgroundContents)) | 47 !command_line->HasSwitch(switches::kDisableRestoreBackgroundContents)) |
48 prefs_ = profile->GetPrefs(); | 48 prefs_ = profile->GetPrefs(); |
49 | 49 |
50 // Listen for events to tell us when to load/unload persisted background | 50 // Listen for events to tell us when to load/unload persisted background |
51 // contents. | 51 // contents. |
52 StartObserving(profile); | 52 StartObserving(profile); |
53 } | 53 } |
54 | 54 |
55 BackgroundContentsService::~BackgroundContentsService() { | 55 BackgroundContentsService::~BackgroundContentsService() { |
56 // BackgroundContents should be shutdown before we go away, as otherwise | 56 // BackgroundContents should be shutdown before we go away, as otherwise |
57 // our browser process refcount will be off. | 57 // our browser process refcount will be off. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 TabContents* new_contents, | 294 TabContents* new_contents, |
295 WindowOpenDisposition disposition, | 295 WindowOpenDisposition disposition, |
296 const gfx::Rect& initial_pos, | 296 const gfx::Rect& initial_pos, |
297 bool user_gesture) { | 297 bool user_gesture) { |
298 Browser* browser = BrowserList::GetLastActiveWithProfile( | 298 Browser* browser = BrowserList::GetLastActiveWithProfile( |
299 new_contents->profile()); | 299 new_contents->profile()); |
300 if (!browser) | 300 if (!browser) |
301 return; | 301 return; |
302 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 302 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
303 } | 303 } |
OLD | NEW |