| 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 "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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 531 |
| 532 bool ExternalTabContainer::TakeFocus(bool reverse) { | 532 bool ExternalTabContainer::TakeFocus(bool reverse) { |
| 533 if (automation_) { | 533 if (automation_) { |
| 534 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, | 534 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, |
| 535 base::win::IsShiftPressed())); | 535 base::win::IsShiftPressed())); |
| 536 } | 536 } |
| 537 | 537 |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 bool ExternalTabContainer::CanDownload(int request_id) { | |
| 542 if (load_requests_via_automation_) { | |
| 543 if (automation_) { | |
| 544 // In case the host needs to show UI that needs to take the focus. | |
| 545 ::AllowSetForegroundWindow(ASFW_ANY); | |
| 546 | |
| 547 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | |
| 548 NewRunnableMethod(automation_resource_message_filter_.get(), | |
| 549 &AutomationResourceMessageFilter::SendDownloadRequestToHost, | |
| 550 0, tab_handle_, request_id)); | |
| 551 } | |
| 552 } else { | |
| 553 DLOG(WARNING) << "Downloads are only supported with host browser network " | |
| 554 "stack enabled."; | |
| 555 } | |
| 556 | |
| 557 // Never allow downloads. | |
| 558 return false; | |
| 559 } | |
| 560 | |
| 561 void ExternalTabContainer::ShowPageInfo(Profile* profile, | 541 void ExternalTabContainer::ShowPageInfo(Profile* profile, |
| 562 const GURL& url, | 542 const GURL& url, |
| 563 const NavigationEntry::SSLStatus& ssl, | 543 const NavigationEntry::SSLStatus& ssl, |
| 564 bool show_history) { | 544 bool show_history) { |
| 565 POINT cursor_pos = {0}; | 545 POINT cursor_pos = {0}; |
| 566 GetCursorPos(&cursor_pos); | 546 GetCursorPos(&cursor_pos); |
| 567 | 547 |
| 568 gfx::Rect bounds; | 548 gfx::Rect bounds; |
| 569 bounds.set_origin(gfx::Point(cursor_pos)); | 549 bounds.set_origin(gfx::Point(cursor_pos)); |
| 570 | 550 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 UnregisterRenderViewHost(rvh); | 756 UnregisterRenderViewHost(rvh); |
| 777 } | 757 } |
| 778 break; | 758 break; |
| 779 } | 759 } |
| 780 default: | 760 default: |
| 781 NOTREACHED(); | 761 NOTREACHED(); |
| 782 } | 762 } |
| 783 } | 763 } |
| 784 | 764 |
| 785 //////////////////////////////////////////////////////////////////////////////// | 765 //////////////////////////////////////////////////////////////////////////////// |
| 766 // ExternalTabContainer, DownloadTabHelperDelegate overrides: |
| 767 |
| 768 bool ExternalTabContainer::CanDownload(int request_id) { |
| 769 if (load_requests_via_automation_) { |
| 770 if (automation_) { |
| 771 // In case the host needs to show UI that needs to take the focus. |
| 772 ::AllowSetForegroundWindow(ASFW_ANY); |
| 773 |
| 774 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 775 NewRunnableMethod(automation_resource_message_filter_.get(), |
| 776 &AutomationResourceMessageFilter::SendDownloadRequestToHost, |
| 777 0, tab_handle_, request_id)); |
| 778 } |
| 779 } else { |
| 780 DLOG(WARNING) << "Downloads are only supported with host browser network " |
| 781 "stack enabled."; |
| 782 } |
| 783 |
| 784 // Never allow downloads. |
| 785 return false; |
| 786 } |
| 787 |
| 788 void ExternalTabContainer::OnStartDownload(DownloadItem* download, |
| 789 TabContentsWrapper* tab) { |
| 790 } |
| 791 |
| 792 |
| 793 //////////////////////////////////////////////////////////////////////////////// |
| 786 // ExternalTabContainer, views::WidgetWin overrides: | 794 // ExternalTabContainer, views::WidgetWin overrides: |
| 787 | 795 |
| 788 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { | 796 LRESULT ExternalTabContainer::OnCreate(LPCREATESTRUCT create_struct) { |
| 789 LRESULT result = views::WidgetWin::OnCreate(create_struct); | 797 LRESULT result = views::WidgetWin::OnCreate(create_struct); |
| 790 if (result == 0) { | 798 if (result == 0) { |
| 791 // Grab a reference here which will be released in OnFinalMessage | 799 // Grab a reference here which will be released in OnFinalMessage |
| 792 AddRef(); | 800 AddRef(); |
| 793 } | 801 } |
| 794 return result; | 802 return result; |
| 795 } | 803 } |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 | 1109 |
| 1102 if (disposition == CURRENT_TAB) { | 1110 if (disposition == CURRENT_TAB) { |
| 1103 DCHECK(route_all_top_level_navigations_); | 1111 DCHECK(route_all_top_level_navigations_); |
| 1104 disposition = NEW_FOREGROUND_TAB; | 1112 disposition = NEW_FOREGROUND_TAB; |
| 1105 } | 1113 } |
| 1106 ExternalTabContainer::OpenURLFromTab(source, url, referrer, disposition, | 1114 ExternalTabContainer::OpenURLFromTab(source, url, referrer, disposition, |
| 1107 transition); | 1115 transition); |
| 1108 // support only one navigation for a dummy tab before it is killed. | 1116 // support only one navigation for a dummy tab before it is killed. |
| 1109 ::DestroyWindow(GetNativeView()); | 1117 ::DestroyWindow(GetNativeView()); |
| 1110 } | 1118 } |
| OLD | NEW |