| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 13 #include "chrome/common/notification_registrar.h" | 13 #include "chrome/common/notification_registrar.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 | 15 |
| 16 class MessageLoop; | 16 class MessageLoop; |
| 17 class NavigationEntry; | 17 class NavigationEntry; |
| 18 class WebContents; | 18 class WebContents; |
| 19 class WebContentsView; |
| 19 | 20 |
| 20 // This class is a base class for interstitial pages, pages that show some | 21 // This class is a base class for interstitial pages, pages that show some |
| 21 // informative message asking for user validation before reaching the target | 22 // informative message asking for user validation before reaching the target |
| 22 // page. (Navigating to a page served over bad HTTPS or a page containing | 23 // page. (Navigating to a page served over bad HTTPS or a page containing |
| 23 // malware are typical cases where an interstitial is required.) | 24 // malware are typical cases where an interstitial is required.) |
| 24 // | 25 // |
| 25 // If specified in its constructor, this class creates a navigation entry so | 26 // If specified in its constructor, this class creates a navigation entry so |
| 26 // that when the interstitial shows, the current entry is the target URL. | 27 // that when the interstitial shows, the current entry is the target URL. |
| 27 // | 28 // |
| 28 // InterstitialPage instances take care of deleting themselves when closed | 29 // InterstitialPage instances take care of deleting themselves when closed |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // navigation controller. | 105 // navigation controller. |
| 105 // Gives an opportunity to sub-classes to set states on the |entry|. | 106 // Gives an opportunity to sub-classes to set states on the |entry|. |
| 106 // Note that this is only called if the InterstitialPage was constructed with | 107 // Note that this is only called if the InterstitialPage was constructed with |
| 107 // |create_navigation_entry| set to true. | 108 // |create_navigation_entry| set to true. |
| 108 virtual void UpdateEntry(NavigationEntry* entry) { } | 109 virtual void UpdateEntry(NavigationEntry* entry) { } |
| 109 | 110 |
| 110 WebContents* tab() const { return tab_; } | 111 WebContents* tab() const { return tab_; } |
| 111 const GURL& url() const { return url_; } | 112 const GURL& url() const { return url_; } |
| 112 RenderViewHost* render_view_host() const { return render_view_host_; } | 113 RenderViewHost* render_view_host() const { return render_view_host_; } |
| 113 | 114 |
| 114 // Creates and shows the RenderViewHost containing the interstitial content. | 115 // Creates the RenderViewHost containing the interstitial content. |
| 115 // Overriden in unit tests. | 116 // Overriden in unit tests. |
| 116 virtual RenderViewHost* CreateRenderViewHost(); | 117 virtual RenderViewHost* CreateRenderViewHost(); |
| 117 | 118 |
| 119 // Creates the WebContentsView that shows the interstitial RVH. |
| 120 // Overriden in unit tests. |
| 121 virtual WebContentsView* CreateWebContentsView(); |
| 122 |
| 118 private: | 123 private: |
| 119 // AutomationProvider needs access to Proceed and DontProceed to simulate | 124 // AutomationProvider needs access to Proceed and DontProceed to simulate |
| 120 // user actions. | 125 // user actions. |
| 121 friend class AutomationProvider; | 126 friend class AutomationProvider; |
| 122 | 127 |
| 123 class InterstitialPageRVHViewDelegate; | 128 class InterstitialPageRVHViewDelegate; |
| 124 | 129 |
| 125 // Initializes tab_to_interstitial_page_ in a thread-safe manner. | 130 // Initializes tab_to_interstitial_page_ in a thread-safe manner. |
| 126 // Should be called before accessing tab_to_interstitial_page_. | 131 // Should be called before accessing tab_to_interstitial_page_. |
| 127 static void InitInterstitialPageMap(); | 132 static void InitInterstitialPageMap(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 186 |
| 182 // We keep a map of the various blocking pages shown as the UI tests need to | 187 // We keep a map of the various blocking pages shown as the UI tests need to |
| 183 // be able to retrieve them. | 188 // be able to retrieve them. |
| 184 typedef std::map<WebContents*,InterstitialPage*> InterstitialPageMap; | 189 typedef std::map<WebContents*,InterstitialPage*> InterstitialPageMap; |
| 185 static InterstitialPageMap* tab_to_interstitial_page_; | 190 static InterstitialPageMap* tab_to_interstitial_page_; |
| 186 | 191 |
| 187 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); | 192 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); |
| 188 }; | 193 }; |
| 189 | 194 |
| 190 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 195 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
| OLD | NEW |