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

Unified Diff: content/browser/tab_contents/interstitial_page.h

Issue 9323071: Use InterstitialPage through a delegate interface instead of deriving from it. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 10 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: content/browser/tab_contents/interstitial_page.h
===================================================================
--- content/browser/tab_contents/interstitial_page.h (revision 120733)
+++ content/browser/tab_contents/interstitial_page.h (working copy)
@@ -22,6 +22,7 @@
class TabContents;
namespace content {
+class InterstitialPageDelegate;
class NavigationEntry;
class WebContents;
class WebContentsView;
@@ -61,15 +62,22 @@
// added to the navigation controller (so the interstitial page appears as a
// new navigation entry). |new_navigation| should be false when the
// interstitial was triggered by a loading a sub-resource in a page.
+ // Takes ownership of |delegate|.
+ static InterstitialPage* Create(content::WebContents* tab,
+ bool new_navigation,
+ const GURL& url,
+ content::InterstitialPageDelegate* delegate);
+
InterstitialPage(content::WebContents* tab,
bool new_navigation,
- const GURL& url);
+ const GURL& url,
+ content::InterstitialPageDelegate* delegate);
virtual ~InterstitialPage();
// Shows the interstitial page in the tab.
- virtual void Show();
+ void Show();
- // Hides the interstitial page. Warning: this deletes the InterstitialPage.
+ // Hides the interstitial page.
void Hide();
// Retrieves the InterstitialPage if any associated with the specified
@@ -77,12 +85,6 @@
static InterstitialPage* GetInterstitialPage(
content::WebContents* web_contents);
- // Sub-classes should return the HTML that should be displayed in the page.
- virtual std::string GetHTMLContents();
-
- // Invoked when the page sent a command through DOMAutomation.
- virtual void CommandReceived(const std::string& command) {}
-
// Reverts to the page showing before the interstitial.
// Sub-classes should call this method when the user has chosen NOT to proceed
// to the target URL.
@@ -112,16 +114,17 @@
// Called when tab traversing.
void FocusThroughTabTraversal(bool reverse);
- virtual content::ViewType GetRenderViewType() const OVERRIDE;
-
- virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
-
// See description above field.
void set_reload_on_dont_proceed(bool value) {
reload_on_dont_proceed_ = value;
}
bool reload_on_dont_proceed() const { return reload_on_dont_proceed_; }
+ RenderViewHost* render_view_host() const { return render_view_host_; }
+
+ content::InterstitialPageDelegate* GetDelegateForTesting();
+ void DontCreateViewForTesting();
+
protected:
// content::NotificationObserver method:
virtual void Observe(int type,
@@ -148,21 +151,12 @@
bool* is_keyboard_shortcut) OVERRIDE;
virtual void HandleKeyboardEvent(
const NativeWebKeyboardEvent& event) OVERRIDE;
+ virtual content::ViewType GetRenderViewType() const OVERRIDE;
+ virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
- // Invoked with the NavigationEntry that is going to be added to the
- // navigation controller.
- // Gives an opportunity to sub-classes to set states on the |entry|.
- // Note that this is only called if the InterstitialPage was constructed with
- // |create_navigation_entry| set to true.
- virtual void UpdateEntry(content::NavigationEntry* entry) {}
-
bool enabled() const { return enabled_; }
content::WebContents* tab() const;
const GURL& url() const { return url_; }
- RenderViewHost* render_view_host() const { return render_view_host_; }
- void set_renderer_preferences(const content::RendererPreferences& prefs) {
- renderer_preferences_ = prefs;
- }
// Creates the RenderViewHost containing the interstitial content.
// Overriden in unit tests.
@@ -256,8 +250,12 @@
static InterstitialPageMap* tab_to_interstitial_page_;
// Settings passed to the renderer.
- content::RendererPreferences renderer_preferences_;
+ mutable content::RendererPreferences renderer_preferences_;
+ bool create_view_;
+
+ scoped_ptr<content::InterstitialPageDelegate> delegate_;
+
DISALLOW_COPY_AND_ASSIGN(InterstitialPage);
};
« no previous file with comments | « chrome/renderer/content_settings_observer_browsertest.cc ('k') | content/browser/tab_contents/interstitial_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698