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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 return (it != contents_map_.end()) ? it->second.contents : NULL; | 741 return (it != contents_map_.end()) ? it->second.contents : NULL; |
742 } | 742 } |
743 | 743 |
744 const string16& BackgroundContentsService::GetParentApplicationId( | 744 const string16& BackgroundContentsService::GetParentApplicationId( |
745 BackgroundContents* contents) const { | 745 BackgroundContents* contents) const { |
746 for (BackgroundContentsMap::const_iterator it = contents_map_.begin(); | 746 for (BackgroundContentsMap::const_iterator it = contents_map_.begin(); |
747 it != contents_map_.end(); ++it) { | 747 it != contents_map_.end(); ++it) { |
748 if (contents == it->second.contents) | 748 if (contents == it->second.contents) |
749 return it->first; | 749 return it->first; |
750 } | 750 } |
751 return EmptyString16(); | 751 return base::EmptyString16(); |
752 } | 752 } |
753 | 753 |
754 void BackgroundContentsService::AddWebContents( | 754 void BackgroundContentsService::AddWebContents( |
755 WebContents* new_contents, | 755 WebContents* new_contents, |
756 WindowOpenDisposition disposition, | 756 WindowOpenDisposition disposition, |
757 const gfx::Rect& initial_pos, | 757 const gfx::Rect& initial_pos, |
758 bool user_gesture, | 758 bool user_gesture, |
759 bool* was_blocked) { | 759 bool* was_blocked) { |
760 Browser* browser = chrome::FindLastActiveWithProfile( | 760 Browser* browser = chrome::FindLastActiveWithProfile( |
761 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 761 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
762 chrome::GetActiveDesktop()); | 762 chrome::GetActiveDesktop()); |
763 if (browser) { | 763 if (browser) { |
764 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 764 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
765 initial_pos, user_gesture, was_blocked); | 765 initial_pos, user_gesture, was_blocked); |
766 } | 766 } |
767 } | 767 } |
OLD | NEW |