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