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/background_contents_service.h | |
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/background_contents_service.h')
-rw-r--r-- | chrome/browser/background_contents_service.h | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/chrome/browser/background_contents_service.h b/chrome/browser/background_contents_service.h index 08165d8..7fe16ac 100644 --- a/chrome/browser/background_contents_service.h +++ b/chrome/browser/background_contents_service.h @@ -7,6 +7,7 @@ #pragma once #include <map> +#include <vector> #include "base/gtest_prod_util.h" #include "chrome/browser/tab_contents/background_contents.h" @@ -45,6 +46,9 @@ class BackgroundContentsService : private NotificationObserver, // or NULL if none. BackgroundContents* GetAppBackgroundContents(const string16& appid); + // Returns all currently opened BackgroundContents (used by the task manager). + std::vector<BackgroundContents*> GetBackgroundContents() const; + static void RegisterUserPrefs(PrefService* prefs); // BackgroundContents::Delegate implementation. @@ -53,12 +57,33 @@ class BackgroundContentsService : private NotificationObserver, const gfx::Rect& initial_pos, bool user_gesture); + // Gets the parent application id for the passed BackgroundContents. Returns + // an empty string if no parent application found (e.g. passed + // BackgroundContents has already shut down). + const string16& GetParentApplicationId(BackgroundContents* contents) const; + + // Creates a new BackgroundContents using the passed |site| and + // the |route_id| and begins tracking the object internally so it can be + // shutdown if the parent application is uninstalled. + // A BACKGROUND_CONTENTS_OPENED notification will be generated with the passed + // |frame_name| and |application_id| values, using the passed |profile| as the + // Source.. + BackgroundContents* CreateBackgroundContents(SiteInstance* site, + int route_id, + Profile* profile, + const string16& frame_name, + const string16& application_id); + private: friend class BackgroundContentsServiceTest; + friend class MockBackgroundContents; + friend class TaskManagerBrowserTest; FRIEND_TEST_ALL_PREFIXES(BackgroundContentsServiceTest, BackgroundContentsCreateDestroy); FRIEND_TEST_ALL_PREFIXES(BackgroundContentsServiceTest, TestApplicationIDLinkage); + FRIEND_TEST_ALL_PREFIXES(TaskManagerBrowserTest, + NoticeBGContentsChanges); // Registers for various notifications. void StartObserving(Profile* profile); @@ -71,13 +96,13 @@ class BackgroundContentsService : private NotificationObserver, // Loads all registered BackgroundContents at startup. void LoadBackgroundContentsFromPrefs(Profile* profile); - // Creates a single BackgroundContents associated with the specified |appid|. - // The BackgroundContents frame will be given the name specified by - // |frame_name| and navigated to the passed URL. - void CreateBackgroundContents(Profile* profile, - const GURL& url, - const string16& frame_name, - const string16& appid); + // Creates a single BackgroundContents associated with the specified |appid|, + // creates an associated RenderView with the name specified by |frame_name|, + // and navigates to the passed |url|. + void LoadBackgroundContents(Profile* profile, + const GURL& url, + const string16& frame_name, + const string16& appid); // Invoked when a new BackgroundContents is opened. void BackgroundContentsOpened(BackgroundContentsOpenedDetails* details); @@ -101,11 +126,6 @@ class BackgroundContentsService : private NotificationObserver, // Returns true if this BackgroundContents is in the contents_list_. bool IsTracked(BackgroundContents* contents) const; - // Gets the parent application id for the passed BackgroundContents. Returns - // an empty string if no parent application found (e.g. passed - // BackgroundContents has already shut down). - const string16& GetParentApplicationId(BackgroundContents* contents) const; - // PrefService used to store list of background pages (or NULL if this is // running under an off-the-record profile). PrefService* prefs_; |