Chromium Code Reviews| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 // Close the crash notification balloon for the app/extension, if any. | 447 // Close the crash notification balloon for the app/extension, if any. |
| 448 ScheduleCloseBalloon(extension->id(), profile); | 448 ScheduleCloseBalloon(extension->id(), profile); |
| 449 SendChangeNotification(profile); | 449 SendChangeNotification(profile); |
| 450 } | 450 } |
| 451 | 451 |
| 452 void BackgroundContentsService::OnExtensionUnloaded( | 452 void BackgroundContentsService::OnExtensionUnloaded( |
| 453 content::BrowserContext* browser_context, | 453 content::BrowserContext* browser_context, |
| 454 const extensions::Extension* extension, | 454 const extensions::Extension* extension, |
| 455 extensions::UnloadedExtensionInfo::Reason reason) { | 455 extensions::UnloadedExtensionInfo::Reason reason) { |
| 456 switch (reason) { | 456 switch (reason) { |
| 457 case UnloadedExtensionInfo::REASON_DISABLE: // Fall through. | 457 case UnloadedExtensionInfo::REASON_DISABLE: // Fall through. |
| 458 case UnloadedExtensionInfo::REASON_TERMINATE: // Fall through. | 458 case UnloadedExtensionInfo::REASON_TERMINATE: // Fall through. |
| 459 case UnloadedExtensionInfo::REASON_UNINSTALL: // Fall through. | 459 case UnloadedExtensionInfo::REASON_UNINSTALL: // Fall through. |
| 460 case UnloadedExtensionInfo::REASON_BLACKLIST: // Fall through. | 460 case UnloadedExtensionInfo::REASON_BLACKLIST: // Fall through. |
| 461 case UnloadedExtensionInfo::REASON_PROFILE_LOCK: // Fall through. | |
| 461 case UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN: | 462 case UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN: |
| 462 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); | 463 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); |
| 463 SendChangeNotification(Profile::FromBrowserContext(browser_context)); | 464 SendChangeNotification(Profile::FromBrowserContext(browser_context)); |
| 464 break; | 465 break; |
| 465 case UnloadedExtensionInfo::REASON_UPDATE: { | 466 case UnloadedExtensionInfo::REASON_UPDATE: { |
| 466 // If there is a manifest specified background page, then shut it down | 467 // If there is a manifest specified background page, then shut it down |
| 467 // here, since if the updated extension still has the background page, | 468 // here, since if the updated extension still has the background page, |
| 468 // then it will be loaded from LOADED callback. Otherwise, leave | 469 // then it will be loaded from LOADED callback. Otherwise, leave |
| 469 // BackgroundContents in place. | 470 // BackgroundContents in place. |
| 470 // We don't call SendChangeNotification here - it will be generated | 471 // We don't call SendChangeNotification here - it will be generated |
| 471 // from the LOADED callback. | 472 // from the LOADED callback. |
| 472 if (BackgroundInfo::HasBackgroundPage(extension)) { | 473 if (BackgroundInfo::HasBackgroundPage(extension)) { |
| 473 ShutdownAssociatedBackgroundContents( | 474 ShutdownAssociatedBackgroundContents( |
| 474 base::ASCIIToUTF16(extension->id())); | 475 base::ASCIIToUTF16(extension->id())); |
| 475 } | 476 } |
| 476 break; | 477 break; |
| 477 } | 478 } |
| 478 default: | 479 default: |
|
not at google - send to devlin
2014/11/12 18:22:59
Cleanup: could you remove this default case entire
Mike Lerman
2014/11/12 20:58:41
Done.
| |
| 479 NOTREACHED(); | 480 NOTREACHED(); |
| 480 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); | 481 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); |
| 481 break; | 482 break; |
| 482 } | 483 } |
| 483 } | 484 } |
| 484 | 485 |
| 485 void BackgroundContentsService::OnExtensionUninstalled( | 486 void BackgroundContentsService::OnExtensionUninstalled( |
| 486 content::BrowserContext* browser_context, | 487 content::BrowserContext* browser_context, |
| 487 const extensions::Extension* extension, | 488 const extensions::Extension* extension, |
| 488 extensions::UninstallReason reason) { | 489 extensions::UninstallReason reason) { |
| (...skipping 281 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 |