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

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: Added missing file 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
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..577e6bdbdcd38f0ec3cae4c952b624166c60607f 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;
@@ -30,6 +31,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 +58,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_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 +93,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_;

Powered by Google App Engine
This is Rietveld 408576698