Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: chrome/browser/background/background_contents_service.cc

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
65 #include "chrome/browser/chromeos/login/user_flow.h" 65 #include "chrome/browser/chromeos/login/user_flow.h"
66 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 66 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
67 #endif 67 #endif
68 68
69 using content::SiteInstance; 69 using content::SiteInstance;
70 using content::WebContents; 70 using content::WebContents;
71 using extensions::BackgroundInfo; 71 using extensions::BackgroundInfo;
72 using extensions::Extension; 72 using extensions::Extension;
73 using extensions::UnloadedExtensionInfo; 73 using extensions::UnloadedExtensionReason;
74 74
75 namespace { 75 namespace {
76 76
77 const char kNotificationPrefix[] = "app.background.crashed."; 77 const char kNotificationPrefix[] = "app.background.crashed.";
78 const char kNotifierId[] = "app.background.crashed"; 78 const char kNotifierId[] = "app.background.crashed";
79 bool g_disable_close_balloon_for_testing = false; 79 bool g_disable_close_balloon_for_testing = false;
80 80
81 void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) { 81 void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) {
82 NotificationUIManager* notification_ui_manager = 82 NotificationUIManager* notification_ui_manager =
83 g_browser_process->notification_ui_manager(); 83 g_browser_process->notification_ui_manager();
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 503
504 // Close the crash notification balloon for the app/extension, if any. 504 // Close the crash notification balloon for the app/extension, if any.
505 ScheduleCloseBalloon(extension->id(), profile); 505 ScheduleCloseBalloon(extension->id(), profile);
506 SendChangeNotification(profile); 506 SendChangeNotification(profile);
507 } 507 }
508 508
509 void BackgroundContentsService::OnExtensionUnloaded( 509 void BackgroundContentsService::OnExtensionUnloaded(
510 content::BrowserContext* browser_context, 510 content::BrowserContext* browser_context,
511 const extensions::Extension* extension, 511 const extensions::Extension* extension,
512 extensions::UnloadedExtensionInfo::Reason reason) { 512 extensions::UnloadedExtensionReason reason) {
513 switch (reason) { 513 switch (reason) {
514 case UnloadedExtensionInfo::REASON_DISABLE: // Fall through. 514 case UnloadedExtensionReason::DISABLE: // Fall through.
515 case UnloadedExtensionInfo::REASON_TERMINATE: // Fall through. 515 case UnloadedExtensionReason::TERMINATE: // Fall through.
516 case UnloadedExtensionInfo::REASON_UNINSTALL: // Fall through. 516 case UnloadedExtensionReason::UNINSTALL: // Fall through.
517 case UnloadedExtensionInfo::REASON_BLACKLIST: // Fall through. 517 case UnloadedExtensionReason::BLACKLIST: // Fall through.
518 case UnloadedExtensionInfo::REASON_LOCK_ALL: // Fall through. 518 case UnloadedExtensionReason::LOCK_ALL: // Fall through.
519 case UnloadedExtensionInfo::REASON_MIGRATED_TO_COMPONENT: // Fall through. 519 case UnloadedExtensionReason::MIGRATED_TO_COMPONENT: // Fall through.
520 case UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN: 520 case UnloadedExtensionReason::PROFILE_SHUTDOWN:
521 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); 521 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id()));
522 SendChangeNotification(Profile::FromBrowserContext(browser_context)); 522 SendChangeNotification(Profile::FromBrowserContext(browser_context));
523 return; 523 return;
524 case UnloadedExtensionInfo::REASON_UPDATE: { 524 case UnloadedExtensionReason::UPDATE: {
525 // If there is a manifest specified background page, then shut it down 525 // If there is a manifest specified background page, then shut it down
526 // here, since if the updated extension still has the background page, 526 // here, since if the updated extension still has the background page,
527 // then it will be loaded from LOADED callback. Otherwise, leave 527 // then it will be loaded from LOADED callback. Otherwise, leave
528 // BackgroundContents in place. 528 // BackgroundContents in place.
529 // We don't call SendChangeNotification here - it will be generated 529 // We don't call SendChangeNotification here - it will be generated
530 // from the LOADED callback. 530 // from the LOADED callback.
531 if (BackgroundInfo::HasBackgroundPage(extension)) { 531 if (BackgroundInfo::HasBackgroundPage(extension)) {
532 ShutdownAssociatedBackgroundContents( 532 ShutdownAssociatedBackgroundContents(
533 base::ASCIIToUTF16(extension->id())); 533 base::ASCIIToUTF16(extension->id()));
534 } 534 }
535 return; 535 return;
536 case UnloadedExtensionInfo::REASON_UNDEFINED: 536 case UnloadedExtensionReason::UNDEFINED:
537 // Fall through to undefined case. 537 // Fall through to undefined case.
538 break; 538 break;
539 } 539 }
540 } 540 }
541 NOTREACHED() << "Undefined case " << reason; 541 NOTREACHED() << "Undefined UnloadedExtensionReason.";
542 return ShutdownAssociatedBackgroundContents( 542 return ShutdownAssociatedBackgroundContents(
543 base::ASCIIToUTF16(extension->id())); 543 base::ASCIIToUTF16(extension->id()));
544 } 544 }
545 545
546 void BackgroundContentsService::OnExtensionUninstalled( 546 void BackgroundContentsService::OnExtensionUninstalled(
547 content::BrowserContext* browser_context, 547 content::BrowserContext* browser_context,
548 const extensions::Extension* extension, 548 const extensions::Extension* extension,
549 extensions::UninstallReason reason) { 549 extensions::UninstallReason reason) {
550 Profile* profile = Profile::FromBrowserContext(browser_context); 550 Profile* profile = Profile::FromBrowserContext(browser_context);
551 // Make sure the extension-crash balloons are removed when the extension is 551 // Make sure the extension-crash balloons are removed when the extension is
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 const gfx::Rect& initial_rect, 862 const gfx::Rect& initial_rect,
863 bool user_gesture, 863 bool user_gesture,
864 bool* was_blocked) { 864 bool* was_blocked) {
865 Browser* browser = chrome::FindLastActiveWithProfile( 865 Browser* browser = chrome::FindLastActiveWithProfile(
866 Profile::FromBrowserContext(new_contents->GetBrowserContext())); 866 Profile::FromBrowserContext(new_contents->GetBrowserContext()));
867 if (browser) { 867 if (browser) {
868 chrome::AddWebContents(browser, NULL, new_contents, disposition, 868 chrome::AddWebContents(browser, NULL, new_contents, disposition,
869 initial_rect, user_gesture, was_blocked); 869 initial_rect, user_gesture, was_blocked);
870 } 870 }
871 } 871 }
OLDNEW
« no previous file with comments | « chrome/browser/background/background_contents_service.h ('k') | chrome/browser/chromeos/accessibility/accessibility_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698