OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
6 #define CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "content/browser/renderer_host/render_view_host_delegate.h" | 14 #include "content/browser/renderer_host/render_view_host_delegate.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/common/renderer_preferences.h" | |
17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/common/renderer_preferences.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
21 | 21 |
22 class NavigationEntry; | 22 class NavigationEntry; |
23 class TabContents; | 23 class TabContents; |
24 class TabContentsView; | 24 class TabContentsView; |
25 | 25 |
26 // This class is a base class for interstitial pages, pages that show some | 26 // This class is a base class for interstitial pages, pages that show some |
27 // informative message asking for user validation before reaching the target | 27 // informative message asking for user validation before reaching the target |
28 // page. (Navigating to a page served over bad HTTPS or a page containing | 28 // page. (Navigating to a page served over bad HTTPS or a page containing |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 virtual void RenderViewGone(RenderViewHost* render_view_host, | 122 virtual void RenderViewGone(RenderViewHost* render_view_host, |
123 base::TerminationStatus status, | 123 base::TerminationStatus status, |
124 int error_code) OVERRIDE; | 124 int error_code) OVERRIDE; |
125 virtual void DidNavigate( | 125 virtual void DidNavigate( |
126 RenderViewHost* render_view_host, | 126 RenderViewHost* render_view_host, |
127 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 127 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
128 virtual void UpdateTitle(RenderViewHost* render_view_host, | 128 virtual void UpdateTitle(RenderViewHost* render_view_host, |
129 int32 page_id, | 129 int32 page_id, |
130 const string16& title, | 130 const string16& title, |
131 base::i18n::TextDirection title_direction) OVERRIDE; | 131 base::i18n::TextDirection title_direction) OVERRIDE; |
132 virtual RendererPreferences GetRendererPrefs( | 132 virtual content::RendererPreferences GetRendererPrefs( |
133 content::BrowserContext* browser_context) const OVERRIDE; | 133 content::BrowserContext* browser_context) const OVERRIDE; |
134 | 134 |
135 // Invoked with the NavigationEntry that is going to be added to the | 135 // Invoked with the NavigationEntry that is going to be added to the |
136 // navigation controller. | 136 // navigation controller. |
137 // Gives an opportunity to sub-classes to set states on the |entry|. | 137 // Gives an opportunity to sub-classes to set states on the |entry|. |
138 // Note that this is only called if the InterstitialPage was constructed with | 138 // Note that this is only called if the InterstitialPage was constructed with |
139 // |create_navigation_entry| set to true. | 139 // |create_navigation_entry| set to true. |
140 virtual void UpdateEntry(NavigationEntry* entry) {} | 140 virtual void UpdateEntry(NavigationEntry* entry) {} |
141 | 141 |
142 bool enabled() const { return enabled_; } | 142 bool enabled() const { return enabled_; } |
143 TabContents* tab() const { return tab_; } | 143 TabContents* tab() const { return tab_; } |
144 const GURL& url() const { return url_; } | 144 const GURL& url() const { return url_; } |
145 RenderViewHost* render_view_host() const { return render_view_host_; } | 145 RenderViewHost* render_view_host() const { return render_view_host_; } |
146 void set_renderer_preferences(const RendererPreferences& prefs) { | 146 void set_renderer_preferences(const content::RendererPreferences& prefs) { |
147 renderer_preferences_ = prefs; | 147 renderer_preferences_ = prefs; |
148 } | 148 } |
149 | 149 |
150 // Creates the RenderViewHost containing the interstitial content. | 150 // Creates the RenderViewHost containing the interstitial content. |
151 // Overriden in unit tests. | 151 // Overriden in unit tests. |
152 virtual RenderViewHost* CreateRenderViewHost(); | 152 virtual RenderViewHost* CreateRenderViewHost(); |
153 | 153 |
154 // Creates the TabContentsView that shows the interstitial RVH. | 154 // Creates the TabContentsView that shows the interstitial RVH. |
155 // Overriden in unit tests. | 155 // Overriden in unit tests. |
156 virtual TabContentsView* CreateTabContentsView(); | 156 virtual TabContentsView* CreateTabContentsView(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 // Our RenderViewHostViewDelegate, necessary for accelerators to work. | 233 // Our RenderViewHostViewDelegate, necessary for accelerators to work. |
234 scoped_ptr<InterstitialPageRVHViewDelegate> rvh_view_delegate_; | 234 scoped_ptr<InterstitialPageRVHViewDelegate> rvh_view_delegate_; |
235 | 235 |
236 // We keep a map of the various blocking pages shown as the UI tests need to | 236 // We keep a map of the various blocking pages shown as the UI tests need to |
237 // be able to retrieve them. | 237 // be able to retrieve them. |
238 typedef std::map<TabContents*, InterstitialPage*> InterstitialPageMap; | 238 typedef std::map<TabContents*, InterstitialPage*> InterstitialPageMap; |
239 static InterstitialPageMap* tab_to_interstitial_page_; | 239 static InterstitialPageMap* tab_to_interstitial_page_; |
240 | 240 |
241 // Settings passed to the renderer. | 241 // Settings passed to the renderer. |
242 RendererPreferences renderer_preferences_; | 242 content::RendererPreferences renderer_preferences_; |
243 | 243 |
244 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); | 244 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); |
245 }; | 245 }; |
246 | 246 |
247 #endif // CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 247 #endif // CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
OLD | NEW |