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 24 matching lines...) Expand all Loading... |
35 // <appid_2>: { "url": <url2>, "name": <frame_name> }, | 35 // <appid_2>: { "url": <url2>, "name": <frame_name> }, |
36 // ... etc ... | 36 // ... etc ... |
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 incognito. |
46 if (!profile->IsOffTheRecord() && | 46 if (!profile->IsOffTheRecord() && |
47 !command_line->HasSwitch(switches::kDisableRestoreBackgroundContents)) | 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() { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 TabContents* new_contents, | 322 TabContents* new_contents, |
323 WindowOpenDisposition disposition, | 323 WindowOpenDisposition disposition, |
324 const gfx::Rect& initial_pos, | 324 const gfx::Rect& initial_pos, |
325 bool user_gesture) { | 325 bool user_gesture) { |
326 Browser* browser = BrowserList::GetLastActiveWithProfile( | 326 Browser* browser = BrowserList::GetLastActiveWithProfile( |
327 new_contents->profile()); | 327 new_contents->profile()); |
328 if (!browser) | 328 if (!browser) |
329 return; | 329 return; |
330 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 330 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
331 } | 331 } |
OLD | NEW |