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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 SendChangeNotification(profile); | 424 SendChangeNotification(profile); |
425 break; | 425 break; |
426 } | 426 } |
427 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: | 427 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: |
428 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED: { | 428 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED: { |
429 Profile* profile = content::Source<Profile>(source).ptr(); | 429 Profile* profile = content::Source<Profile>(source).ptr(); |
430 const Extension* extension = NULL; | 430 const Extension* extension = NULL; |
431 if (type == chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED) { | 431 if (type == chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED) { |
432 BackgroundContents* bg = | 432 BackgroundContents* bg = |
433 content::Details<BackgroundContents>(details).ptr(); | 433 content::Details<BackgroundContents>(details).ptr(); |
434 std::string extension_id = UTF16ToASCII( | 434 std::string extension_id = base::UTF16ToASCII( |
435 BackgroundContentsServiceFactory::GetForProfile(profile)-> | 435 BackgroundContentsServiceFactory::GetForProfile(profile)-> |
436 GetParentApplicationId(bg)); | 436 GetParentApplicationId(bg)); |
437 extension = | 437 extension = |
438 extensions::ExtensionSystem::Get(profile)->extension_service()-> | 438 extensions::ExtensionSystem::Get(profile)->extension_service()-> |
439 GetExtensionById(extension_id, false); | 439 GetExtensionById(extension_id, false); |
440 } else { | 440 } else { |
441 extensions::ExtensionHost* extension_host = | 441 extensions::ExtensionHost* extension_host = |
442 content::Details<extensions::ExtensionHost>(details).ptr(); | 442 content::Details<extensions::ExtensionHost>(details).ptr(); |
443 extension = extension_host->extension(); | 443 extension = extension_host->extension(); |
444 } | 444 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 731 } |
732 | 732 |
733 void BackgroundContentsService::BackgroundContentsOpened( | 733 void BackgroundContentsService::BackgroundContentsOpened( |
734 BackgroundContentsOpenedDetails* details) { | 734 BackgroundContentsOpenedDetails* details) { |
735 // Add the passed object to our list. Should not already be tracked. | 735 // Add the passed object to our list. Should not already be tracked. |
736 DCHECK(!IsTracked(details->contents)); | 736 DCHECK(!IsTracked(details->contents)); |
737 DCHECK(!details->application_id.empty()); | 737 DCHECK(!details->application_id.empty()); |
738 contents_map_[details->application_id].contents = details->contents; | 738 contents_map_[details->application_id].contents = details->contents; |
739 contents_map_[details->application_id].frame_name = details->frame_name; | 739 contents_map_[details->application_id].frame_name = details->frame_name; |
740 | 740 |
741 ScheduleCloseBalloon(UTF16ToASCII(details->application_id)); | 741 ScheduleCloseBalloon(base::UTF16ToASCII(details->application_id)); |
742 } | 742 } |
743 | 743 |
744 // Used by test code and debug checks to verify whether a given | 744 // Used by test code and debug checks to verify whether a given |
745 // BackgroundContents is being tracked by this instance. | 745 // BackgroundContents is being tracked by this instance. |
746 bool BackgroundContentsService::IsTracked( | 746 bool BackgroundContentsService::IsTracked( |
747 BackgroundContents* background_contents) const { | 747 BackgroundContents* background_contents) const { |
748 return !GetParentApplicationId(background_contents).empty(); | 748 return !GetParentApplicationId(background_contents).empty(); |
749 } | 749 } |
750 | 750 |
751 void BackgroundContentsService::BackgroundContentsShutdown( | 751 void BackgroundContentsService::BackgroundContentsShutdown( |
(...skipping 27 matching lines...) Expand all Loading... |
779 bool user_gesture, | 779 bool user_gesture, |
780 bool* was_blocked) { | 780 bool* was_blocked) { |
781 Browser* browser = chrome::FindLastActiveWithProfile( | 781 Browser* browser = chrome::FindLastActiveWithProfile( |
782 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 782 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
783 chrome::GetActiveDesktop()); | 783 chrome::GetActiveDesktop()); |
784 if (browser) { | 784 if (browser) { |
785 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 785 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
786 initial_pos, user_gesture, was_blocked); | 786 initial_pos, user_gesture, was_blocked); |
787 } | 787 } |
788 } | 788 } |
OLD | NEW |