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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 dict->GetString(kUrlKey, &url); | 586 dict->GetString(kUrlKey, &url); |
587 dict->GetString(kFrameNameKey, &frame_name); | 587 dict->GetString(kFrameNameKey, &frame_name); |
588 LoadBackgroundContents(profile, | 588 LoadBackgroundContents(profile, |
589 GURL(url), | 589 GURL(url), |
590 frame_name, | 590 frame_name, |
591 base::UTF8ToUTF16(extension_id)); | 591 base::UTF8ToUTF16(extension_id)); |
592 } | 592 } |
593 | 593 |
594 void BackgroundContentsService::LoadBackgroundContentsFromManifests( | 594 void BackgroundContentsService::LoadBackgroundContentsFromManifests( |
595 Profile* profile) { | 595 Profile* profile) { |
596 const extensions::ExtensionSet* extensions = | 596 for (const scoped_refptr<const extensions::Extension>& extension : |
597 extensions::ExtensionSystem::Get(profile)-> | 597 extensions::ExtensionRegistry::Get(profile)->enabled_extensions()) { |
598 extension_service()->extensions(); | |
599 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); | |
600 iter != extensions->end(); ++iter) { | |
601 const Extension* extension = iter->get(); | |
602 if (extension->is_hosted_app() && | 598 if (extension->is_hosted_app() && |
603 BackgroundInfo::HasBackgroundPage(extension)) { | 599 BackgroundInfo::HasBackgroundPage(extension.get())) { |
604 LoadBackgroundContents(profile, | 600 LoadBackgroundContents( |
605 BackgroundInfo::GetBackgroundURL(extension), | 601 profile, BackgroundInfo::GetBackgroundURL(extension.get()), |
606 base::ASCIIToUTF16("background"), | 602 base::ASCIIToUTF16("background"), base::UTF8ToUTF16(extension->id())); |
607 base::UTF8ToUTF16(extension->id())); | |
608 } | 603 } |
609 } | 604 } |
610 } | 605 } |
611 | 606 |
612 void BackgroundContentsService::LoadBackgroundContents( | 607 void BackgroundContentsService::LoadBackgroundContents( |
613 Profile* profile, | 608 Profile* profile, |
614 const GURL& url, | 609 const GURL& url, |
615 const base::string16& frame_name, | 610 const base::string16& frame_name, |
616 const base::string16& application_id) { | 611 const base::string16& application_id) { |
617 // We are depending on the fact that we will initialize before any user | 612 // We are depending on the fact that we will initialize before any user |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 bool user_gesture, | 765 bool user_gesture, |
771 bool* was_blocked) { | 766 bool* was_blocked) { |
772 Browser* browser = chrome::FindLastActiveWithProfile( | 767 Browser* browser = chrome::FindLastActiveWithProfile( |
773 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 768 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
774 chrome::GetActiveDesktop()); | 769 chrome::GetActiveDesktop()); |
775 if (browser) { | 770 if (browser) { |
776 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 771 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
777 initial_pos, user_gesture, was_blocked); | 772 initial_pos, user_gesture, was_blocked); |
778 } | 773 } |
779 } | 774 } |
OLD | NEW |