Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2569)

Unified Diff: chrome/browser/guest_view/guest_view_manager.h

Issue 334923002: Remove ContentBrowserClient::GuestWebContentsAttached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_adview
Patch Set: Hopefully fixed tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/guest_view/guest_view_base.cc ('k') | chrome/browser/guest_view/guest_view_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/guest_view/guest_view_manager.h
diff --git a/chrome/browser/guest_view/guest_view_manager.h b/chrome/browser/guest_view/guest_view_manager.h
index 5a904cb58a36a3083b7f4b247fd880d27cf6cceb..55eab59ee48f0d1d0797f0caf98122c486b163a1 100644
--- a/chrome/browser/guest_view/guest_view_manager.h
+++ b/chrome/browser/guest_view/guest_view_manager.h
@@ -15,6 +15,7 @@
#include "content/public/browser/web_contents.h"
class GuestViewBase;
+class GuestViewManagerFactory;
class GuestWebContentsObserver;
class GURL;
@@ -22,6 +23,10 @@ namespace content {
class BrowserContext;
} // namespace content
+namespace guestview {
+class TestGuestViewManager;
+} // namespace guestview
+
class GuestViewManager : public content::BrowserPluginGuestManager,
public base::SupportsUserData::Data {
public:
@@ -30,6 +35,11 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
static GuestViewManager* FromBrowserContext(content::BrowserContext* context);
+ // Overrides factory for testing. Default (NULL) value indicates regular
+ // (non-test) environment.
+ static void set_factory_for_testing(GuestViewManagerFactory* factory) {
+ GuestViewManager::factory_ = factory;
+ }
// Returns the guest WebContents associated with the given |guest_instance_id|
// if the provided |embedder_render_process_id| is allowed to access it.
// If the embedder is not allowed access, the embedder will be killed, and
@@ -52,14 +62,15 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
virtual bool ForEachGuest(content::WebContents* embedder_web_contents,
const GuestCallback& callback) OVERRIDE;
- private:
+ protected:
friend class GuestViewBase;
friend class GuestWebContentsObserver;
- friend class TestGuestViewManager;
+ friend class guestview::TestGuestViewManager;
FRIEND_TEST_ALL_PREFIXES(GuestViewManagerTest, AddRemove);
- void AddGuest(int guest_instance_id,
- content::WebContents* guest_web_contents);
+ // Can be overriden in tests.
+ virtual void AddGuest(int guest_instance_id,
+ content::WebContents* guest_web_contents);
void RemoveGuest(int guest_instance_id);
@@ -86,6 +97,9 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
static bool CanEmbedderAccessGuest(int embedder_render_process_id,
GuestViewBase* guest);
+ // Static factory instance (always NULL for non-test).
+ static GuestViewManagerFactory* factory_;
+
// Contains guests' WebContents, mapping from their instance ids.
typedef std::map<int, content::WebContents*> GuestInstanceMap;
GuestInstanceMap guest_web_contents_by_instance_id_;
« no previous file with comments | « chrome/browser/guest_view/guest_view_base.cc ('k') | chrome/browser/guest_view/guest_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698