| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/external_tab_container_win.h" | 5 #include "chrome/browser/external_tab_container_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 } | 577 } |
| 578 | 578 |
| 579 // Never allow downloads. | 579 // Never allow downloads. |
| 580 return false; | 580 return false; |
| 581 } | 581 } |
| 582 | 582 |
| 583 void ExternalTabContainer::RegisterRenderViewHostForAutomation( | 583 void ExternalTabContainer::RegisterRenderViewHostForAutomation( |
| 584 RenderViewHost* render_view_host, bool pending_view) { | 584 RenderViewHost* render_view_host, bool pending_view) { |
| 585 if (render_view_host) { | 585 if (render_view_host) { |
| 586 AutomationResourceMessageFilter::RegisterRenderView( | 586 AutomationResourceMessageFilter::RegisterRenderView( |
| 587 render_view_host->process()->GetID(), | 587 render_view_host->GetProcess()->GetID(), |
| 588 render_view_host->routing_id(), | 588 render_view_host->GetRoutingID(), |
| 589 tab_handle(), | 589 tab_handle(), |
| 590 automation_resource_message_filter_, | 590 automation_resource_message_filter_, |
| 591 pending_view); | 591 pending_view); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void ExternalTabContainer::RegisterRenderViewHost( | 595 void ExternalTabContainer::RegisterRenderViewHost( |
| 596 RenderViewHost* render_view_host) { | 596 RenderViewHost* render_view_host) { |
| 597 // RenderViewHost instances that are to be associated with this | 597 // RenderViewHost instances that are to be associated with this |
| 598 // ExternalTabContainer should share the same resource request automation | 598 // ExternalTabContainer should share the same resource request automation |
| 599 // settings. | 599 // settings. |
| 600 RegisterRenderViewHostForAutomation( | 600 RegisterRenderViewHostForAutomation( |
| 601 render_view_host, | 601 render_view_host, |
| 602 false); // Network requests should not be handled later. | 602 false); // Network requests should not be handled later. |
| 603 } | 603 } |
| 604 | 604 |
| 605 void ExternalTabContainer::UnregisterRenderViewHost( | 605 void ExternalTabContainer::UnregisterRenderViewHost( |
| 606 RenderViewHost* render_view_host) { | 606 RenderViewHost* render_view_host) { |
| 607 // Undo the resource automation registration performed in | 607 // Undo the resource automation registration performed in |
| 608 // ExternalTabContainer::RegisterRenderViewHost. | 608 // ExternalTabContainer::RegisterRenderViewHost. |
| 609 if (render_view_host) { | 609 if (render_view_host) { |
| 610 AutomationResourceMessageFilter::UnRegisterRenderView( | 610 AutomationResourceMessageFilter::UnRegisterRenderView( |
| 611 render_view_host->process()->GetID(), | 611 render_view_host->GetProcess()->GetID(), |
| 612 render_view_host->routing_id()); | 612 render_view_host->GetRoutingID()); |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 content::JavaScriptDialogCreator* | 616 content::JavaScriptDialogCreator* |
| 617 ExternalTabContainer::GetJavaScriptDialogCreator() { | 617 ExternalTabContainer::GetJavaScriptDialogCreator() { |
| 618 return GetJavaScriptDialogCreatorInstance(); | 618 return GetJavaScriptDialogCreatorInstance(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 bool ExternalTabContainer::HandleContextMenu( | 621 bool ExternalTabContainer::HandleContextMenu( |
| 622 const content::ContextMenuParams& params) { | 622 const content::ContextMenuParams& params) { |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 accelerator, ui::AcceleratorManager::kNormalPriority, this); | 1125 accelerator, ui::AcceleratorManager::kNormalPriority, this); |
| 1126 } | 1126 } |
| 1127 } | 1127 } |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 void ExternalTabContainer::OnReinitialize() { | 1130 void ExternalTabContainer::OnReinitialize() { |
| 1131 if (load_requests_via_automation_) { | 1131 if (load_requests_via_automation_) { |
| 1132 RenderViewHost* rvh = tab_contents_->web_contents()->GetRenderViewHost(); | 1132 RenderViewHost* rvh = tab_contents_->web_contents()->GetRenderViewHost(); |
| 1133 if (rvh) { | 1133 if (rvh) { |
| 1134 AutomationResourceMessageFilter::ResumePendingRenderView( | 1134 AutomationResourceMessageFilter::ResumePendingRenderView( |
| 1135 rvh->process()->GetID(), rvh->routing_id(), | 1135 rvh->GetProcess()->GetID(), rvh->GetRoutingID(), |
| 1136 tab_handle_, automation_resource_message_filter_); | 1136 tab_handle_, automation_resource_message_filter_); |
| 1137 } | 1137 } |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 NavigationStateChanged(web_contents(), 0); | 1140 NavigationStateChanged(web_contents(), 0); |
| 1141 ServicePendingOpenURLRequests(); | 1141 ServicePendingOpenURLRequests(); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 void ExternalTabContainer::ServicePendingOpenURLRequests() { | 1144 void ExternalTabContainer::ServicePendingOpenURLRequests() { |
| 1145 DCHECK(pending()); | 1145 DCHECK(pending()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 if (params.disposition == CURRENT_TAB) { | 1207 if (params.disposition == CURRENT_TAB) { |
| 1208 DCHECK(route_all_top_level_navigations_); | 1208 DCHECK(route_all_top_level_navigations_); |
| 1209 forward_params.disposition = NEW_FOREGROUND_TAB; | 1209 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1210 } | 1210 } |
| 1211 WebContents* new_contents = | 1211 WebContents* new_contents = |
| 1212 ExternalTabContainer::OpenURLFromTab(source, forward_params); | 1212 ExternalTabContainer::OpenURLFromTab(source, forward_params); |
| 1213 // support only one navigation for a dummy tab before it is killed. | 1213 // support only one navigation for a dummy tab before it is killed. |
| 1214 ::DestroyWindow(GetNativeView()); | 1214 ::DestroyWindow(GetNativeView()); |
| 1215 return new_contents; | 1215 return new_contents; |
| 1216 } | 1216 } |
| OLD | NEW |