| Index: chrome/browser/tab_contents/interstitial_page.cc
|
| ===================================================================
|
| --- chrome/browser/tab_contents/interstitial_page.cc (revision 9548)
|
| +++ chrome/browser/tab_contents/interstitial_page.cc (working copy)
|
| @@ -66,6 +66,38 @@
|
|
|
| } // namespace
|
|
|
| +class InterstitialPage::InterstitialPageRVHViewDelegate
|
| + : public RenderViewHostDelegate::View {
|
| + public:
|
| + explicit InterstitialPageRVHViewDelegate(InterstitialPage* page);
|
| +
|
| + // RenderViewHostDelegate::View implementation:
|
| + virtual void CreateNewWindow(int route_id,
|
| + base::WaitableEvent* modal_dialog_event);
|
| + virtual void CreateNewWidget(int route_id, bool activatable);
|
| + virtual void ShowCreatedWindow(int route_id,
|
| + WindowOpenDisposition disposition,
|
| + const gfx::Rect& initial_pos,
|
| + bool user_gesture);
|
| + virtual void ShowCreatedWidget(int route_id,
|
| + const gfx::Rect& initial_pos);
|
| + virtual void ShowContextMenu(const ContextMenuParams& params);
|
| + virtual void StartDragging(const WebDropData& drop_data);
|
| + virtual void UpdateDragCursor(bool is_drop_target);
|
| + virtual void TakeFocus(bool reverse);
|
| + virtual void HandleKeyboardEvent(const WebKeyboardEvent& event);
|
| + virtual void OnFindReply(int request_id,
|
| + int number_of_matches,
|
| + const gfx::Rect& selection_rect,
|
| + int active_match_ordinal,
|
| + bool final_update);
|
| +
|
| + private:
|
| + InterstitialPage* interstitial_page_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InterstitialPageRVHViewDelegate);
|
| +};
|
| +
|
| // static
|
| InterstitialPage::InterstitialPageMap*
|
| InterstitialPage::tab_to_interstitial_page_ = NULL;
|
| @@ -83,7 +115,8 @@
|
| render_view_host_(NULL),
|
| resource_dispatcher_host_notified_(false),
|
| should_revert_tab_title_(false),
|
| - ui_loop_(MessageLoop::current()) {
|
| + ui_loop_(MessageLoop::current()),
|
| + rvh_view_delegate_(new InterstitialPageRVHViewDelegate(this)) {
|
| InitInterstitialPageMap();
|
| // It would be inconsistent to create an interstitial with no new navigation
|
| // (which is the case when the interstitial was triggered by a sub-resource on
|
| @@ -287,7 +320,10 @@
|
| }
|
|
|
| void InterstitialPage::SetSize(const gfx::Size& size) {
|
| - render_view_host_->view()->SetSize(size);
|
| + // When a tab is closed, we might be resized after our view was NULLed
|
| + // (typically if there was an info-bar).
|
| + if (render_view_host_->view())
|
| + render_view_host_->view()->SetSize(size);
|
| }
|
|
|
| Profile* InterstitialPage::GetProfile() const {
|
| @@ -343,6 +379,10 @@
|
| tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
|
| }
|
|
|
| +RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() const {
|
| + return rvh_view_delegate_.get();
|
| +}
|
| +
|
| void InterstitialPage::Disable() {
|
| enabled_ = false;
|
| }
|
| @@ -391,3 +431,60 @@
|
| return iter->second;
|
| }
|
|
|
| +InterstitialPage::InterstitialPageRVHViewDelegate::
|
| + InterstitialPageRVHViewDelegate(InterstitialPage* page)
|
| + : interstitial_page_(page) {
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWindow(
|
| + int route_id, base::WaitableEvent* modal_dialog_event) {
|
| + NOTREACHED() << "InterstitialPage does not support showing popups yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::CreateNewWidget(
|
| + int route_id, bool activatable) {
|
| + NOTREACHED() << "InterstitialPage does not support showing drop-downs yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::ShowCreatedWindow(
|
| + int route_id, WindowOpenDisposition disposition,
|
| + const gfx::Rect& initial_pos, bool user_gesture) {
|
| + NOTREACHED() << "InterstitialPage does not support showing popups yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::ShowCreatedWidget(
|
| + int route_id, const gfx::Rect& initial_pos) {
|
| + NOTREACHED() << "InterstitialPage does not support showing drop-downs yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::ShowContextMenu(
|
| + const ContextMenuParams& params) {
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::StartDragging(
|
| + const WebDropData& drop_data) {
|
| + NOTREACHED() << "InterstitialPage does not support dragging yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::UpdateDragCursor(
|
| + bool is_drop_target) {
|
| + NOTREACHED() << "InterstitialPage does not support dragging yet.";
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus(
|
| + bool reverse) {
|
| + if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate())
|
| + interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse);
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::HandleKeyboardEvent(
|
| + const WebKeyboardEvent& event) {
|
| + if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate())
|
| + interstitial_page_->tab()->GetViewDelegate()->HandleKeyboardEvent(event);
|
| +}
|
| +
|
| +void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply(
|
| + int request_id, int number_of_matches, const gfx::Rect& selection_rect,
|
| + int active_match_ordinal, bool final_update) {
|
| +}
|
| +
|
|
|