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

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

Issue 695133005: Temporarily disable extensions and sync while a profile is locked - Profiles Approach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compiling is awesome Created 6 years, 1 month 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 "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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_LOCK_ALL: // 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 return;
Andrew T Wilson (Slow) 2014/11/17 16:09:24 Why did this change from break to return?
not at google - send to devlin 2014/11/17 17:04:20 Because I asked Mike to, see below.
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 return;
477 } 478 case UnloadedExtensionInfo::REASON_UNDEFINED:
Andrew T Wilson (Slow) 2014/11/17 16:09:24 I think this line is mis-indented. Also, no defaul
not at google - send to devlin 2014/11/17 17:04:20 No default case is good for compilation, however y
478 default:
479 NOTREACHED(); 479 NOTREACHED();
not at google - send to devlin 2014/11/17 17:04:20 I think there is a bit of miscommunication here -
Mike Lerman 2014/11/19 14:54:34 Done.
480 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id())); 480 ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(extension->id()));
481 break; 481 return;
482 }
482 } 483 }
not at google - send to devlin 2014/11/17 17:04:20 Then here write: NOTREACHED() << "Undefined case
Mike Lerman 2014/11/19 14:54:34 Done.
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) {
489 Profile* profile = Profile::FromBrowserContext(browser_context); 490 Profile* profile = Profile::FromBrowserContext(browser_context);
490 // Make sure the extension-crash balloons are removed when the extension is 491 // Make sure the extension-crash balloons are removed when the extension is
491 // uninstalled/reloaded. We cannot do this from UNLOADED since a crashed 492 // uninstalled/reloaded. We cannot do this from UNLOADED since a crashed
492 // extension is unloaded immediately after the crash, not when user reloads or 493 // extension is unloaded immediately after the crash, not when user reloads or
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698