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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 const base::string16& application_id) { | 633 const base::string16& application_id) { |
634 // We are depending on the fact that we will initialize before any user | 634 // We are depending on the fact that we will initialize before any user |
635 // actions or session restore can take place, so no BackgroundContents should | 635 // actions or session restore can take place, so no BackgroundContents should |
636 // be running yet for the passed application_id. | 636 // be running yet for the passed application_id. |
637 DCHECK(!GetAppBackgroundContents(application_id)); | 637 DCHECK(!GetAppBackgroundContents(application_id)); |
638 DCHECK(!application_id.empty()); | 638 DCHECK(!application_id.empty()); |
639 DCHECK(url.is_valid()); | 639 DCHECK(url.is_valid()); |
640 DVLOG(1) << "Loading background content url: " << url; | 640 DVLOG(1) << "Loading background content url: " << url; |
641 | 641 |
642 BackgroundContents* contents = CreateBackgroundContents( | 642 BackgroundContents* contents = CreateBackgroundContents( |
643 SiteInstance::CreateForURL(profile, url), | 643 SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, |
644 MSG_ROUTING_NONE, | 644 MSG_ROUTING_NONE, MSG_ROUTING_NONE, profile, frame_name, application_id, |
645 MSG_ROUTING_NONE, | 645 std::string(), NULL); |
646 profile, | |
647 frame_name, | |
648 application_id, | |
649 std::string(), | |
650 NULL); | |
651 | 646 |
652 contents->CreateRenderViewSoon(url); | 647 contents->CreateRenderViewSoon(url); |
653 } | 648 } |
654 | 649 |
655 BackgroundContents* BackgroundContentsService::CreateBackgroundContents( | 650 BackgroundContents* BackgroundContentsService::CreateBackgroundContents( |
656 SiteInstance* site, | 651 SiteInstance* site, |
657 int routing_id, | 652 int32_t routing_id, |
658 int main_frame_route_id, | 653 int32_t main_frame_route_id, |
| 654 int32_t main_frame_widget_route_id, |
659 Profile* profile, | 655 Profile* profile, |
660 const std::string& frame_name, | 656 const std::string& frame_name, |
661 const base::string16& application_id, | 657 const base::string16& application_id, |
662 const std::string& partition_id, | 658 const std::string& partition_id, |
663 content::SessionStorageNamespace* session_storage_namespace) { | 659 content::SessionStorageNamespace* session_storage_namespace) { |
664 BackgroundContents* contents = new BackgroundContents( | 660 BackgroundContents* contents = new BackgroundContents( |
665 site, routing_id, main_frame_route_id, this, partition_id, | 661 site, routing_id, main_frame_route_id, main_frame_widget_route_id, this, |
666 session_storage_namespace); | 662 partition_id, session_storage_namespace); |
667 | 663 |
668 // Register the BackgroundContents internally, then send out a notification | 664 // Register the BackgroundContents internally, then send out a notification |
669 // to external listeners. | 665 // to external listeners. |
670 BackgroundContentsOpenedDetails details = {contents, | 666 BackgroundContentsOpenedDetails details = {contents, |
671 frame_name, | 667 frame_name, |
672 application_id}; | 668 application_id}; |
673 BackgroundContentsOpened(&details, profile); | 669 BackgroundContentsOpened(&details, profile); |
674 content::NotificationService::current()->Notify( | 670 content::NotificationService::current()->Notify( |
675 chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, | 671 chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, |
676 content::Source<Profile>(profile), | 672 content::Source<Profile>(profile), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 bool user_gesture, | 783 bool user_gesture, |
788 bool* was_blocked) { | 784 bool* was_blocked) { |
789 Browser* browser = chrome::FindLastActiveWithProfile( | 785 Browser* browser = chrome::FindLastActiveWithProfile( |
790 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 786 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
791 chrome::GetActiveDesktop()); | 787 chrome::GetActiveDesktop()); |
792 if (browser) { | 788 if (browser) { |
793 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 789 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
794 initial_rect, user_gesture, was_blocked); | 790 initial_rect, user_gesture, was_blocked); |
795 } | 791 } |
796 } | 792 } |
OLD | NEW |