diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-16 21:49:08 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-16 21:49:08 +0000 |
commit | bc09387b3f27ae3d450823c2885f4822e36accce (patch) | |
tree | 56a9304cdcf6659ee235fc1338641ebc3d7ee281 /chrome/browser/background_contents_service.cc | |
parent | b7c1fd1fb7ace48afcc09504fd213d6ede0c383c (diff) | |
download | chromium_src-bc09387b3f27ae3d450823c2885f4822e36accce.zip chromium_src-bc09387b3f27ae3d450823c2885f4822e36accce.tar.gz chromium_src-bc09387b3f27ae3d450823c2885f4822e36accce.tar.bz2 |
Create BackgroundContents::Delegate interface to break dependency on browser.h
BUG=50554
Review URL: http://codereview.chromium.org/3106012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background_contents_service.cc')
-rw-r--r-- | chrome/browser/background_contents_service.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/chrome/browser/background_contents_service.cc b/chrome/browser/background_contents_service.cc index 2bf2239..3202bac 100644 --- a/chrome/browser/background_contents_service.cc +++ b/chrome/browser/background_contents_service.cc @@ -9,13 +9,14 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/site_instance.h" -#include "chrome/browser/tab_contents/background_contents.h" +#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" @@ -184,7 +185,9 @@ void BackgroundContentsService::CreateBackgroundContents( } BackgroundContents* contents = new BackgroundContents( - SiteInstance::CreateSiteInstanceForURL(profile, url), MSG_ROUTING_NONE); + SiteInstance::CreateSiteInstanceForURL(profile, url), + MSG_ROUTING_NONE, + this); // TODO(atwilson): Change this to send a BACKGROUND_CONTENTS_CREATED // notification when we have a listener outside of BackgroundContentsService. @@ -300,3 +303,15 @@ const string16& BackgroundContentsService::GetParentApplicationId( void BackgroundContentsService::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents); } + +void BackgroundContentsService::AddTabContents( + TabContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { + Browser* browser = BrowserList::GetLastActiveWithProfile( + new_contents->profile()); + if (!browser) + return; + browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); +} |