| 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/notification_observer.h" | 16 #include "content/common/notification_observer.h" |
| 16 #include "content/common/notification_registrar.h" | 17 #include "content/common/notification_registrar.h" |
| 17 #include "content/common/renderer_preferences.h" | 18 #include "content/common/renderer_preferences.h" |
| 18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 20 | 21 |
| 21 class NavigationEntry; | 22 class NavigationEntry; |
| 22 class TabContents; | 23 class TabContents; |
| 23 class TabContentsView; | 24 class TabContentsView; |
| 24 | 25 |
| 25 // 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 |
| 26 // informative message asking for user validation before reaching the target | 27 // informative message asking for user validation before reaching the target |
| 27 // 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 |
| 28 // malware are typical cases where an interstitial is required.) | 29 // malware are typical cases where an interstitial is required.) |
| 29 // | 30 // |
| 30 // If specified in its constructor, this class creates a navigation entry so | 31 // If specified in its constructor, this class creates a navigation entry so |
| 31 // that when the interstitial shows, the current entry is the target URL. | 32 // that when the interstitial shows, the current entry is the target URL. |
| 32 // | 33 // |
| 33 // InterstitialPage instances take care of deleting themselves when closed | 34 // InterstitialPage instances take care of deleting themselves when closed |
| 34 // through a navigation, the TabContents closing them or the tab containing them | 35 // through a navigation, the TabContents closing them or the tab containing them |
| 35 // being closed. | 36 // being closed. |
| 36 | 37 |
| 37 enum ResourceRequestAction { | 38 enum ResourceRequestAction { |
| 38 BLOCK, | 39 BLOCK, |
| 39 RESUME, | 40 RESUME, |
| 40 CANCEL | 41 CANCEL |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 class InterstitialPage : public NotificationObserver, | 44 class CONTENT_EXPORT InterstitialPage : public NotificationObserver, |
| 44 public RenderViewHostDelegate { | 45 public RenderViewHostDelegate { |
| 45 public: | 46 public: |
| 46 // The different state of actions the user can take in an interstitial. | 47 // The different state of actions the user can take in an interstitial. |
| 47 enum ActionState { | 48 enum ActionState { |
| 48 NO_ACTION, // No action has been taken yet. | 49 NO_ACTION, // No action has been taken yet. |
| 49 PROCEED_ACTION, // "Proceed" was selected. | 50 PROCEED_ACTION, // "Proceed" was selected. |
| 50 DONT_PROCEED_ACTION // "Don't proceed" was selected. | 51 DONT_PROCEED_ACTION // "Don't proceed" was selected. |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 // Creates an interstitial page to show in |tab|. |new_navigation| should be | 54 // Creates an interstitial page to show in |tab|. |new_navigation| should be |
| 54 // set to true when the interstitial is caused by loading a new page, in which | 55 // set to true when the interstitial is caused by loading a new page, in which |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 typedef std::map<TabContents*, InterstitialPage*> InterstitialPageMap; | 238 typedef std::map<TabContents*, InterstitialPage*> InterstitialPageMap; |
| 238 static InterstitialPageMap* tab_to_interstitial_page_; | 239 static InterstitialPageMap* tab_to_interstitial_page_; |
| 239 | 240 |
| 240 // Settings passed to the renderer. | 241 // Settings passed to the renderer. |
| 241 RendererPreferences renderer_preferences_; | 242 RendererPreferences renderer_preferences_; |
| 242 | 243 |
| 243 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); | 244 DISALLOW_COPY_AND_ASSIGN(InterstitialPage); |
| 244 }; | 245 }; |
| 245 | 246 |
| 246 #endif // CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ | 247 #endif // CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ |
| OLD | NEW |