Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 BackgroundContentsShutdown(Details<BackgroundContents>(details).ptr()); | 106 BackgroundContentsShutdown(Details<BackgroundContents>(details).ptr()); |
| 107 break; | 107 break; |
| 108 case NotificationType::BACKGROUND_CONTENTS_CLOSED: | 108 case NotificationType::BACKGROUND_CONTENTS_CLOSED: |
| 109 DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); | 109 DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); |
| 110 UnregisterBackgroundContents(Details<BackgroundContents>(details).ptr()); | 110 UnregisterBackgroundContents(Details<BackgroundContents>(details).ptr()); |
| 111 break; | 111 break; |
| 112 case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: | 112 case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: |
| 113 DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); | 113 DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); |
| 114 RegisterBackgroundContents(Details<BackgroundContents>(details).ptr()); | 114 RegisterBackgroundContents(Details<BackgroundContents>(details).ptr()); |
| 115 break; | 115 break; |
| 116 case NotificationType::EXTENSION_UNLOADED: | 116 case NotificationType::EXTENSION_UNLOADED: |
| 117 ShutdownAssociatedBackgroundContents( | 117 switch (Details<UnloadedExtensionInfo>(details)->reason) { |
| 118 ASCIIToUTF16( | 118 case UnloadedExtensionInfo::DISABLE: // Intentionally fall through. |
| 119 Details<UnloadedExtensionInfo>(details)->extension->id())); | 119 case UnloadedExtensionInfo::UNINSTALL: |
| 120 ShutdownAssociatedBackgroundContents( | |
| 121 ASCIIToUTF16( | |
| 122 Details<UnloadedExtensionInfo>(details)->extension->id())); | |
| 123 break; | |
| 124 case UnloadedExtensionInfo::UPDATE: | |
| 125 // Leave background content in place | |
|
Andrew T Wilson (Slow)
2011/01/14 01:41:34
nit: should be "BackgroundContents" not "backgroun
The wrong rickcam account
2011/01/14 02:13:36
Done.
| |
| 126 break; | |
| 127 default: | |
| 128 NOTREACHED(); | |
| 129 break; | |
| 130 } | |
| 120 break; | 131 break; |
| 121 default: | 132 default: |
| 122 NOTREACHED(); | 133 NOTREACHED(); |
| 123 break; | 134 break; |
| 124 } | 135 } |
| 125 } | 136 } |
| 126 | 137 |
| 127 // Loads all background contents whose urls have been stored in prefs. | 138 // Loads all background contents whose urls have been stored in prefs. |
| 128 void BackgroundContentsService::LoadBackgroundContentsFromPrefs( | 139 void BackgroundContentsService::LoadBackgroundContentsFromPrefs( |
| 129 Profile* profile) { | 140 Profile* profile) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 TabContents* new_contents, | 319 TabContents* new_contents, |
| 309 WindowOpenDisposition disposition, | 320 WindowOpenDisposition disposition, |
| 310 const gfx::Rect& initial_pos, | 321 const gfx::Rect& initial_pos, |
| 311 bool user_gesture) { | 322 bool user_gesture) { |
| 312 Browser* browser = BrowserList::GetLastActiveWithProfile( | 323 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 313 new_contents->profile()); | 324 new_contents->profile()); |
| 314 if (!browser) | 325 if (!browser) |
| 315 return; | 326 return; |
| 316 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 327 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
| 317 } | 328 } |
| OLD | NEW |