| 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/ui/views/external_tab_container_win.h" | 5 #include "chrome/browser/ui/views/external_tab_container_win.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atlconv.h> | 9 #include <atlconv.h> |
| 10 #include <atlmisc.h> | 10 #include <atlmisc.h> |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, | 657 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, |
| 658 bool reverse) { | 658 bool reverse) { |
| 659 if (automation_) { | 659 if (automation_) { |
| 660 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, | 660 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, |
| 661 base::win::IsShiftPressed())); | 661 base::win::IsShiftPressed())); |
| 662 } | 662 } |
| 663 | 663 |
| 664 return true; | 664 return true; |
| 665 } | 665 } |
| 666 | 666 |
| 667 bool ExternalTabContainerWin::CanDownload(RenderViewHost* render_view_host, | 667 void ExternalTabContainerWin::CanDownload( |
| 668 int request_id, | 668 RenderViewHost* render_view_host, |
| 669 const std::string& request_method) { | 669 int request_id, |
| 670 const std::string& request_method, |
| 671 const base::Callback<void(bool)>& callback) { |
| 670 if (load_requests_via_automation_) { | 672 if (load_requests_via_automation_) { |
| 671 if (automation_) { | 673 if (automation_) { |
| 672 // In case the host needs to show UI that needs to take the focus. | 674 // In case the host needs to show UI that needs to take the focus. |
| 673 ::AllowSetForegroundWindow(ASFW_ANY); | 675 ::AllowSetForegroundWindow(ASFW_ANY); |
| 674 | 676 |
| 675 BrowserThread::PostTask( | 677 BrowserThread::PostTask( |
| 676 BrowserThread::IO, FROM_HERE, | 678 BrowserThread::IO, FROM_HERE, |
| 677 base::Bind( | 679 base::Bind( |
| 678 base::IgnoreResult( | 680 base::IgnoreResult( |
| 679 &AutomationResourceMessageFilter::SendDownloadRequestToHost), | 681 &AutomationResourceMessageFilter::SendDownloadRequestToHost), |
| 680 automation_resource_message_filter_.get(), 0, tab_handle_, | 682 automation_resource_message_filter_.get(), 0, tab_handle_, |
| 681 request_id)); | 683 request_id)); |
| 682 } | 684 } |
| 683 } else { | 685 } else { |
| 684 DLOG(WARNING) << "Downloads are only supported with host browser network " | 686 DLOG(WARNING) << "Downloads are only supported with host browser network " |
| 685 "stack enabled."; | 687 "stack enabled."; |
| 686 } | 688 } |
| 687 | 689 |
| 688 // Never allow downloads. | 690 // Never allow downloads. |
| 689 return false; | 691 callback.Run(false); |
| 690 } | 692 } |
| 691 | 693 |
| 692 void ExternalTabContainerWin::RegisterRenderViewHostForAutomation( | 694 void ExternalTabContainerWin::RegisterRenderViewHostForAutomation( |
| 693 RenderViewHost* render_view_host, | 695 RenderViewHost* render_view_host, |
| 694 bool pending_view) { | 696 bool pending_view) { |
| 695 if (render_view_host) { | 697 if (render_view_host) { |
| 696 AutomationResourceMessageFilter::RegisterRenderView( | 698 AutomationResourceMessageFilter::RegisterRenderView( |
| 697 render_view_host->GetProcess()->GetID(), | 699 render_view_host->GetProcess()->GetID(), |
| 698 render_view_host->GetRoutingID(), | 700 render_view_host->GetRoutingID(), |
| 699 GetTabHandle(), | 701 GetTabHandle(), |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 if (params.disposition == CURRENT_TAB) { | 1299 if (params.disposition == CURRENT_TAB) { |
| 1298 DCHECK(route_all_top_level_navigations_); | 1300 DCHECK(route_all_top_level_navigations_); |
| 1299 forward_params.disposition = NEW_FOREGROUND_TAB; | 1301 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1300 } | 1302 } |
| 1301 WebContents* new_contents = | 1303 WebContents* new_contents = |
| 1302 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1304 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
| 1303 // support only one navigation for a dummy tab before it is killed. | 1305 // support only one navigation for a dummy tab before it is killed. |
| 1304 widget_->CloseNow(); | 1306 widget_->CloseNow(); |
| 1305 return new_contents; | 1307 return new_contents; |
| 1306 } | 1308 } |
| OLD | NEW |