| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/interstitial_page.h" | 5 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } // namespace | 81 } // namespace |
| 82 | 82 |
| 83 class InterstitialPage::InterstitialPageRVHViewDelegate | 83 class InterstitialPage::InterstitialPageRVHViewDelegate |
| 84 : public RenderViewHostDelegate::View { | 84 : public RenderViewHostDelegate::View { |
| 85 public: | 85 public: |
| 86 explicit InterstitialPageRVHViewDelegate(InterstitialPage* page); | 86 explicit InterstitialPageRVHViewDelegate(InterstitialPage* page); |
| 87 | 87 |
| 88 // RenderViewHostDelegate::View implementation: | 88 // RenderViewHostDelegate::View implementation: |
| 89 virtual void CreateNewWindow( | 89 virtual void CreateNewWindow( |
| 90 int route_id, | 90 int route_id, |
| 91 WindowContainerType window_container_type); | 91 WindowContainerType window_container_type, |
| 92 const string16& frame_name); |
| 92 virtual void CreateNewWidget(int route_id, | 93 virtual void CreateNewWidget(int route_id, |
| 93 WebKit::WebPopupType popup_type); | 94 WebKit::WebPopupType popup_type); |
| 94 virtual void ShowCreatedWindow(int route_id, | 95 virtual void ShowCreatedWindow(int route_id, |
| 95 WindowOpenDisposition disposition, | 96 WindowOpenDisposition disposition, |
| 96 const gfx::Rect& initial_pos, | 97 const gfx::Rect& initial_pos, |
| 97 bool user_gesture); | 98 bool user_gesture); |
| 98 virtual void ShowCreatedWidget(int route_id, | 99 virtual void ShowCreatedWidget(int route_id, |
| 99 const gfx::Rect& initial_pos); | 100 const gfx::Rect& initial_pos); |
| 100 virtual void ShowContextMenu(const ContextMenuParams& params); | 101 virtual void ShowContextMenu(const ContextMenuParams& params); |
| 101 virtual void StartDragging(const WebDropData& drop_data, | 102 virtual void StartDragging(const WebDropData& drop_data, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 RenderWidgetHostView* view = | 401 RenderWidgetHostView* view = |
| 401 tab_contents_view->CreateViewForWidget(render_view_host_); | 402 tab_contents_view->CreateViewForWidget(render_view_host_); |
| 402 render_view_host_->set_view(view); | 403 render_view_host_->set_view(view); |
| 403 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); | 404 render_view_host_->AllowBindings(BindingsPolicy::DOM_AUTOMATION); |
| 404 | 405 |
| 405 scoped_refptr<URLRequestContextGetter> request_context = | 406 scoped_refptr<URLRequestContextGetter> request_context = |
| 406 tab()->request_context(); | 407 tab()->request_context(); |
| 407 if (!request_context.get()) | 408 if (!request_context.get()) |
| 408 request_context = tab()->profile()->GetRequestContext(); | 409 request_context = tab()->profile()->GetRequestContext(); |
| 409 | 410 |
| 410 render_view_host_->CreateRenderView(request_context.get()); | 411 render_view_host_->CreateRenderView(request_context.get(), string16()); |
| 411 view->SetSize(tab_contents_view->GetContainerSize()); | 412 view->SetSize(tab_contents_view->GetContainerSize()); |
| 412 // Don't show the interstitial until we have navigated to it. | 413 // Don't show the interstitial until we have navigated to it. |
| 413 view->Hide(); | 414 view->Hide(); |
| 414 return tab_contents_view; | 415 return tab_contents_view; |
| 415 } | 416 } |
| 416 | 417 |
| 417 void InterstitialPage::Proceed() { | 418 void InterstitialPage::Proceed() { |
| 418 if (action_taken_ != NO_ACTION) { | 419 if (action_taken_ != NO_ACTION) { |
| 419 NOTREACHED(); | 420 NOTREACHED(); |
| 420 return; | 421 return; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 return iter->second; | 554 return iter->second; |
| 554 } | 555 } |
| 555 | 556 |
| 556 InterstitialPage::InterstitialPageRVHViewDelegate:: | 557 InterstitialPage::InterstitialPageRVHViewDelegate:: |
| 557 InterstitialPageRVHViewDelegate(InterstitialPage* page) | 558 InterstitialPageRVHViewDelegate(InterstitialPage* page) |
| 558 : interstitial_page_(page) { | 559 : interstitial_page_(page) { |
| 559 } | 560 } |
| 560 | 561 |
| 561 void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow( | 562 void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow( |
| 562 int route_id, | 563 int route_id, |
| 563 WindowContainerType window_container_type) { | 564 WindowContainerType window_container_type, |
| 565 const string16& frame_name) { |
| 564 NOTREACHED() << "InterstitialPage does not support showing popups yet."; | 566 NOTREACHED() << "InterstitialPage does not support showing popups yet."; |
| 565 } | 567 } |
| 566 | 568 |
| 567 void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWidget( | 569 void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWidget( |
| 568 int route_id, WebKit::WebPopupType popup_type) { | 570 int route_id, WebKit::WebPopupType popup_type) { |
| 569 NOTREACHED() << "InterstitialPage does not support showing drop-downs yet."; | 571 NOTREACHED() << "InterstitialPage does not support showing drop-downs yet."; |
| 570 } | 572 } |
| 571 | 573 |
| 572 void InterstitialPage::InterstitialPageRVHViewDelegate::ShowCreatedWindow( | 574 void InterstitialPage::InterstitialPageRVHViewDelegate::ShowCreatedWindow( |
| 573 int route_id, WindowOpenDisposition disposition, | 575 int route_id, WindowOpenDisposition disposition, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 637 } |
| 636 | 638 |
| 637 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 639 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 638 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 640 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 639 int active_match_ordinal, bool final_update) { | 641 int active_match_ordinal, bool final_update) { |
| 640 } | 642 } |
| 641 | 643 |
| 642 int InterstitialPage::GetBrowserWindowID() const { | 644 int InterstitialPage::GetBrowserWindowID() const { |
| 643 return tab_->GetBrowserWindowID(); | 645 return tab_->GetBrowserWindowID(); |
| 644 } | 646 } |
| OLD | NEW |