| 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 <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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 324 } |
| 325 | 325 |
| 326 void ExternalTabContainerWin::SetTabHandle(int handle) { | 326 void ExternalTabContainerWin::SetTabHandle(int handle) { |
| 327 tab_handle_ = handle; | 327 tab_handle_ = handle; |
| 328 } | 328 } |
| 329 | 329 |
| 330 int ExternalTabContainerWin::GetTabHandle() const { | 330 int ExternalTabContainerWin::GetTabHandle() const { |
| 331 return tab_handle_; | 331 return tab_handle_; |
| 332 } | 332 } |
| 333 | 333 |
| 334 bool ExternalTabContainerWin::ExecuteContextMenuCommand(int command) { |
| 335 if (!external_context_menu_.get()) { |
| 336 NOTREACHED(); |
| 337 return false; |
| 338 } |
| 339 |
| 340 switch (command) { |
| 341 case IDS_CONTENT_CONTEXT_SAVEAUDIOAS: |
| 342 case IDS_CONTENT_CONTEXT_SAVEVIDEOAS: |
| 343 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: |
| 344 case IDS_CONTENT_CONTEXT_SAVELINKAS: { |
| 345 NOTREACHED(); // Should be handled in host. |
| 346 break; |
| 347 } |
| 348 } |
| 349 |
| 350 external_context_menu_->ExecuteCommand(command); |
| 351 return true; |
| 352 } |
| 353 |
| 334 void ExternalTabContainerWin::RunUnloadHandlers(IPC::Message* reply_message) { | 354 void ExternalTabContainerWin::RunUnloadHandlers(IPC::Message* reply_message) { |
| 335 if (!automation_) { | 355 if (!automation_) { |
| 336 delete reply_message; | 356 delete reply_message; |
| 337 return; | 357 return; |
| 338 } | 358 } |
| 339 | 359 |
| 340 // If we have a pending unload message, then just respond back to this | 360 // If we have a pending unload message, then just respond back to this |
| 341 // request and continue processing the previous unload message. | 361 // request and continue processing the previous unload message. |
| 342 if (unload_reply_message_) { | 362 if (unload_reply_message_) { |
| 343 AutomationMsg_RunUnloadHandlers::WriteReplyParams(reply_message, true); | 363 AutomationMsg_RunUnloadHandlers::WriteReplyParams(reply_message, true); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 if (automation_) { | 608 if (automation_) { |
| 589 string16 url_string = CA2W(url.spec().c_str()); | 609 string16 url_string = CA2W(url.spec().c_str()); |
| 590 automation_->Send( | 610 automation_->Send( |
| 591 new AutomationMsg_UpdateTargetUrl(tab_handle_, url_string)); | 611 new AutomationMsg_UpdateTargetUrl(tab_handle_, url_string)); |
| 592 } | 612 } |
| 593 } | 613 } |
| 594 | 614 |
| 595 void ExternalTabContainerWin::ContentsZoomChange(bool zoom_in) { | 615 void ExternalTabContainerWin::ContentsZoomChange(bool zoom_in) { |
| 596 } | 616 } |
| 597 | 617 |
| 598 gfx::NativeWindow ExternalTabContainerWin::GetFrameNativeWindow() { | |
| 599 return GetNativeView(); | |
| 600 } | |
| 601 | |
| 602 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, | 618 bool ExternalTabContainerWin::TakeFocus(content::WebContents* source, |
| 603 bool reverse) { | 619 bool reverse) { |
| 604 if (automation_) { | 620 if (automation_) { |
| 605 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, | 621 automation_->Send(new AutomationMsg_TabbedOut(tab_handle_, |
| 606 base::win::IsShiftPressed())); | 622 base::win::IsShiftPressed())); |
| 607 } | 623 } |
| 608 | 624 |
| 609 return true; | 625 return true; |
| 610 } | 626 } |
| 611 | 627 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 | 720 |
| 705 bool rtl = base::i18n::IsRTL(); | 721 bool rtl = base::i18n::IsRTL(); |
| 706 automation_->Send( | 722 automation_->Send( |
| 707 new AutomationMsg_ForwardContextMenuToExternalHost(tab_handle_, | 723 new AutomationMsg_ForwardContextMenuToExternalHost(tab_handle_, |
| 708 *context_menu_model, | 724 *context_menu_model, |
| 709 rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN, ipc_params)); | 725 rtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN, ipc_params)); |
| 710 | 726 |
| 711 return true; | 727 return true; |
| 712 } | 728 } |
| 713 | 729 |
| 714 bool ExternalTabContainerWin::ExecuteContextMenuCommand(int command) { | |
| 715 if (!external_context_menu_.get()) { | |
| 716 NOTREACHED(); | |
| 717 return false; | |
| 718 } | |
| 719 | |
| 720 switch (command) { | |
| 721 case IDS_CONTENT_CONTEXT_SAVEAUDIOAS: | |
| 722 case IDS_CONTENT_CONTEXT_SAVEVIDEOAS: | |
| 723 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: | |
| 724 case IDS_CONTENT_CONTEXT_SAVELINKAS: { | |
| 725 NOTREACHED(); // Should be handled in host. | |
| 726 break; | |
| 727 } | |
| 728 } | |
| 729 | |
| 730 external_context_menu_->ExecuteCommand(command); | |
| 731 return true; | |
| 732 } | |
| 733 | |
| 734 bool ExternalTabContainerWin::PreHandleKeyboardEvent( | 730 bool ExternalTabContainerWin::PreHandleKeyboardEvent( |
| 735 content::WebContents* source, | 731 content::WebContents* source, |
| 736 const NativeWebKeyboardEvent& event, | 732 const NativeWebKeyboardEvent& event, |
| 737 bool* is_keyboard_shortcut) { | 733 bool* is_keyboard_shortcut) { |
| 738 return false; | 734 return false; |
| 739 } | 735 } |
| 740 | 736 |
| 741 void ExternalTabContainerWin::HandleKeyboardEvent( | 737 void ExternalTabContainerWin::HandleKeyboardEvent( |
| 742 content::WebContents* source, | 738 content::WebContents* source, |
| 743 const NativeWebKeyboardEvent& event) { | 739 const NativeWebKeyboardEvent& event) { |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 if (params.disposition == CURRENT_TAB) { | 1269 if (params.disposition == CURRENT_TAB) { |
| 1274 DCHECK(route_all_top_level_navigations_); | 1270 DCHECK(route_all_top_level_navigations_); |
| 1275 forward_params.disposition = NEW_FOREGROUND_TAB; | 1271 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 1276 } | 1272 } |
| 1277 WebContents* new_contents = | 1273 WebContents* new_contents = |
| 1278 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1274 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
| 1279 // support only one navigation for a dummy tab before it is killed. | 1275 // support only one navigation for a dummy tab before it is killed. |
| 1280 ::DestroyWindow(GetNativeView()); | 1276 ::DestroyWindow(GetNativeView()); |
| 1281 return new_contents; | 1277 return new_contents; |
| 1282 } | 1278 } |
| OLD | NEW |