| 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 #include "content/browser/tab_contents/interstitial_page.h" | 5 #include "content/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
| 30 #include "content/public/common/bindings_policy.h" | 30 #include "content/public/common/bindings_policy.h" |
| 31 #include "content/public/common/page_transition_types.h" | 31 #include "content/public/common/page_transition_types.h" |
| 32 #include "content/public/common/view_type.h" | 32 #include "content/public/common/view_type.h" |
| 33 #include "net/base/escape.h" | 33 #include "net/base/escape.h" |
| 34 #include "net/url_request/url_request_context_getter.h" | 34 #include "net/url_request/url_request_context_getter.h" |
| 35 | 35 |
| 36 using content::BrowserThread; | 36 using content::BrowserThread; |
| 37 using content::NavigationController; |
| 37 using content::NavigationEntry; | 38 using content::NavigationEntry; |
| 38 using content::NavigationEntryImpl; | 39 using content::NavigationEntryImpl; |
| 39 using content::WebContents; | 40 using content::WebContents; |
| 40 using WebKit::WebDragOperation; | 41 using WebKit::WebDragOperation; |
| 41 using WebKit::WebDragOperationsMask; | 42 using WebKit::WebDragOperationsMask; |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 void ResourceRequestHelper(ResourceDispatcherHost* resource_dispatcher_host, | 46 void ResourceRequestHelper(ResourceDispatcherHost* resource_dispatcher_host, |
| 46 int process_id, | 47 int process_id, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 CreateTabContentsView(); | 205 CreateTabContentsView(); |
| 205 | 206 |
| 206 std::string data_url = "data:text/html;charset=utf-8," + | 207 std::string data_url = "data:text/html;charset=utf-8," + |
| 207 net::EscapePath(GetHTMLContents()); | 208 net::EscapePath(GetHTMLContents()); |
| 208 render_view_host_->NavigateToURL(GURL(data_url)); | 209 render_view_host_->NavigateToURL(GURL(data_url)); |
| 209 | 210 |
| 210 notification_registrar_.Add(this, | 211 notification_registrar_.Add(this, |
| 211 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 212 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 212 content::Source<WebContents>(tab_)); | 213 content::Source<WebContents>(tab_)); |
| 213 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 214 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 214 content::Source<content::NavigationController>(&tab_->GetController())); | 215 content::Source<NavigationController>(&tab_->GetController())); |
| 215 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 216 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 216 content::Source<content::NavigationController>(&tab_->GetController())); | 217 content::Source<NavigationController>(&tab_->GetController())); |
| 217 } | 218 } |
| 218 | 219 |
| 219 void InterstitialPage::Hide() { | 220 void InterstitialPage::Hide() { |
| 220 RenderWidgetHostView* old_view = tab_->GetRenderViewHost()->view(); | 221 RenderWidgetHostView* old_view = tab_->GetRenderViewHost()->view(); |
| 221 if (tab_->GetInterstitialPage() == this && | 222 if (tab_->GetInterstitialPage() == this && |
| 222 old_view && !old_view->IsShowing()) { | 223 old_view && !old_view->IsShowing()) { |
| 223 // Show the original RVH since we're going away. Note it might not exist if | 224 // Show the original RVH since we're going away. Note it might not exist if |
| 224 // the renderer crashed while the interstitial was showing. | 225 // the renderer crashed while the interstitial was showing. |
| 225 // Note that it is important that we don't call Show() if the view is | 226 // Note that it is important that we don't call Show() if the view is |
| 226 // already showing. That would result in bad things (unparented HWND on | 227 // already showing. That would result in bad things (unparented HWND on |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 if (!tab->GetViewDelegate()) | 685 if (!tab->GetViewDelegate()) |
| 685 return; | 686 return; |
| 686 | 687 |
| 687 tab->GetViewDelegate()->TakeFocus(reverse); | 688 tab->GetViewDelegate()->TakeFocus(reverse); |
| 688 } | 689 } |
| 689 | 690 |
| 690 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 691 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 691 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 692 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 692 int active_match_ordinal, bool final_update) { | 693 int active_match_ordinal, bool final_update) { |
| 693 } | 694 } |
| OLD | NEW |