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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 namespace { 54 namespace {
55 55
56 const char kNotificationPrefix[] = "app.background.crashed."; 56 const char kNotificationPrefix[] = "app.background.crashed.";
57 57
58 void CloseBalloon(const std::string id) { 58 void CloseBalloon(const std::string id) {
59 g_browser_process->notification_ui_manager()->CancelById(id); 59 g_browser_process->notification_ui_manager()->CancelById(id);
60 } 60 }
61 61
62 void ScheduleCloseBalloon(const std::string& extension_id) { 62 void ScheduleCloseBalloon(const std::string& extension_id) {
63 if (!MessageLoop::current()) // For unit_tests 63 if (!base::MessageLoop::current()) // For unit_tests
64 return; 64 return;
65 MessageLoop::current()->PostTask( 65 base::MessageLoop::current()->PostTask(
66 FROM_HERE, base::Bind(&CloseBalloon, kNotificationPrefix + extension_id)); 66 FROM_HERE, base::Bind(&CloseBalloon, kNotificationPrefix + extension_id));
67 } 67 }
68 68
69 class CrashNotificationDelegate : public NotificationDelegate { 69 class CrashNotificationDelegate : public NotificationDelegate {
70 public: 70 public:
71 CrashNotificationDelegate(Profile* profile, 71 CrashNotificationDelegate(Profile* profile,
72 const Extension* extension) 72 const Extension* extension)
73 : profile_(profile), 73 : profile_(profile),
74 is_hosted_app_(extension->is_hosted_app()), 74 is_hosted_app_(extension->is_hosted_app()),
75 is_platform_app_(extension->is_platform_app()), 75 is_platform_app_(extension->is_platform_app()),
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 extension = extension_host->extension(); 367 extension = extension_host->extension();
368 } 368 }
369 if (!extension) 369 if (!extension)
370 break; 370 break;
371 371
372 // When an extension crashes, EXTENSION_PROCESS_TERMINATED is followed by 372 // When an extension crashes, EXTENSION_PROCESS_TERMINATED is followed by
373 // an EXTENSION_UNLOADED notification. This UNLOADED signal causes all the 373 // an EXTENSION_UNLOADED notification. This UNLOADED signal causes all the
374 // notifications for this extension to be cancelled by 374 // notifications for this extension to be cancelled by
375 // DesktopNotificationService. For this reason, instead of showing the 375 // DesktopNotificationService. For this reason, instead of showing the
376 // balloon right now, we schedule it to show a little later. 376 // balloon right now, we schedule it to show a little later.
377 MessageLoop::current()->PostTask( 377 base::MessageLoop::current()->PostTask(
378 FROM_HERE, base::Bind(&ShowBalloon, extension, profile)); 378 FROM_HERE, base::Bind(&ShowBalloon, extension, profile));
379 break; 379 break;
380 } 380 }
381 case chrome::NOTIFICATION_EXTENSION_UNLOADED: 381 case chrome::NOTIFICATION_EXTENSION_UNLOADED:
382 switch (content::Details<UnloadedExtensionInfo>(details)->reason) { 382 switch (content::Details<UnloadedExtensionInfo>(details)->reason) {
383 case extension_misc::UNLOAD_REASON_DISABLE: // Fall through. 383 case extension_misc::UNLOAD_REASON_DISABLE: // Fall through.
384 case extension_misc::UNLOAD_REASON_TERMINATE: // Fall through. 384 case extension_misc::UNLOAD_REASON_TERMINATE: // Fall through.
385 case extension_misc::UNLOAD_REASON_UNINSTALL: // Fall through. 385 case extension_misc::UNLOAD_REASON_UNINSTALL: // Fall through.
386 case extension_misc::UNLOAD_REASON_BLACKLIST: 386 case extension_misc::UNLOAD_REASON_BLACKLIST:
387 ShutdownAssociatedBackgroundContents( 387 ShutdownAssociatedBackgroundContents(
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 bool user_gesture, 682 bool user_gesture,
683 bool* was_blocked) { 683 bool* was_blocked) {
684 Browser* browser = chrome::FindLastActiveWithProfile( 684 Browser* browser = chrome::FindLastActiveWithProfile(
685 Profile::FromBrowserContext(new_contents->GetBrowserContext()), 685 Profile::FromBrowserContext(new_contents->GetBrowserContext()),
686 chrome::GetActiveDesktop()); 686 chrome::GetActiveDesktop());
687 if (browser) { 687 if (browser) {
688 chrome::AddWebContents(browser, NULL, new_contents, disposition, 688 chrome::AddWebContents(browser, NULL, new_contents, disposition,
689 initial_pos, user_gesture, was_blocked); 689 initial_pos, user_gesture, was_blocked);
690 } 690 }
691 } 691 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/url_request_automation_job.cc ('k') | chrome/browser/background/background_mode_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698