diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 19:31:12 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-10 19:31:12 +0000 |
commit | da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5 (patch) | |
tree | bbdc8f01e3a24d791abc41ce5404e3202e803def /chrome/browser/tab_contents | |
parent | 4f35e4b08dbd1ed5221402a5aba29a69ef27fa58 (diff) | |
download | chromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.zip chromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.tar.gz chromium_src-da58f5b14586b6db155a22b8b1c8d4de8cf6d8f5.tar.bz2 |
Added support for displaying BackgroundContents in the task manager.
Previously BackgroundContents would get created, but since they were
not TabContents, they would not show up.
BUG=62105
TEST=TaskManagerBrowserTest.NoticeBGContentsChanges
Review URL: http://codereview.chromium.org/4760001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/background_contents.cc | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/background_contents.h | 8 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_delegate_helper.cc | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 41735d8..413810e 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -218,3 +218,15 @@ void BackgroundContents::ShowCreatedWidget(int route_id, void BackgroundContents::ShowCreatedFullscreenWidget(int route_id) { NOTIMPLEMENTED(); } + +// static +BackgroundContents* +BackgroundContents::GetBackgroundContentsByID(int render_process_id, + int render_view_id) { + RenderViewHost* render_view_host = + RenderViewHost::FromID(render_process_id, render_view_id); + if (!render_view_host) + return NULL; + + return render_view_host->delegate()->GetAsBackgroundContents(); +} diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index 63a30d9..81ae92d 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -58,6 +58,7 @@ class BackgroundContents : public RenderViewHostDelegate, RenderViewHost* render_view_host() { return render_view_host_; } // RenderViewHostDelegate implementation. + virtual BackgroundContents* GetAsBackgroundContents() { return this; } virtual RenderViewHostDelegate::View* GetViewDelegate() { return this; } virtual const GURL& GetURL() const { return url_; } virtual ViewType::Type GetRenderViewType() const; @@ -135,6 +136,13 @@ class BackgroundContents : public RenderViewHostDelegate, const std::string& value); virtual void ClearInspectorSettings(); + // Helper to find the BackgroundContents that originated the given request. + // Can be NULL if the page has been closed or some other error occurs. + // Should only be called from the UI thread, since it accesses + // BackgroundContents. + static BackgroundContents* GetBackgroundContentsByID(int render_process_id, + int render_view_id); + protected: // Exposed for testing. BackgroundContents(); diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 15ff1ca..8c8754d 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -67,18 +67,8 @@ RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( return NULL; // Passed all the checks, so this should be created as a BackgroundContents. - BackgroundContents* contents = new BackgroundContents( - site, - route_id, - profile->GetBackgroundContentsService()); - string16 appid = ASCIIToUTF16(extension->id()); - BackgroundContentsOpenedDetails details = { contents, frame_name, appid }; - NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_OPENED, - Source<Profile>(profile), - Details<BackgroundContentsOpenedDetails>(&details)); - - return contents; + return profile->GetBackgroundContentsService()->CreateBackgroundContents( + site, route_id, profile, frame_name, ASCIIToUTF16(extension->id())); } TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( |