| 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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 return; | 555 return; |
| 556 | 556 |
| 557 aura::Window* window = GetContentNativeView(); | 557 aura::Window* window = GetContentNativeView(); |
| 558 gfx::Point screen_loc = display::Screen::GetScreen()->GetCursorScreenPoint(); | 558 gfx::Point screen_loc = display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 559 gfx::Point client_loc = screen_loc; | 559 gfx::Point client_loc = screen_loc; |
| 560 aura::client::ScreenPositionClient* screen_position_client = | 560 aura::client::ScreenPositionClient* screen_position_client = |
| 561 aura::client::GetScreenPositionClient(window->GetRootWindow()); | 561 aura::client::GetScreenPositionClient(window->GetRootWindow()); |
| 562 if (screen_position_client) | 562 if (screen_position_client) |
| 563 screen_position_client->ConvertPointFromScreen(window, &client_loc); | 563 screen_position_client->ConvertPointFromScreen(window, &client_loc); |
| 564 | 564 |
| 565 if (!drag_start_rwh_) | 565 // TODO(paulmeyer): In the OOPIF case, should |client_loc| be converted to |
| 566 return; | 566 // the coordinates local to |drag_start_rwh_|? See crbug.com/647249. |
| 567 | 567 web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.x(), |
| 568 if (drag_start_rwh_.get() == | 568 screen_loc.x(), screen_loc.y(), ops, |
| 569 web_contents_->GetRenderViewHost()->GetWidget()) { | 569 drag_start_rwh_.get()); |
| 570 web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.x(), | |
| 571 screen_loc.x(), screen_loc.y(), ops); | |
| 572 } | |
| 573 | |
| 574 // TODO(paulmeyer): In the OOPIF case, should |client_loc| be converted to the | |
| 575 // coordinates local to |drag_start_rwh_|? See crbug.com/647249. | |
| 576 drag_start_rwh_->DragSourceEndedAt(client_loc, screen_loc, ops); | |
| 577 } | 570 } |
| 578 | 571 |
| 579 void WebContentsViewAura::InstallOverscrollControllerDelegate( | 572 void WebContentsViewAura::InstallOverscrollControllerDelegate( |
| 580 RenderWidgetHostViewAura* view) { | 573 RenderWidgetHostViewAura* view) { |
| 581 const std::string value = base::CommandLine::ForCurrentProcess()-> | 574 const std::string value = base::CommandLine::ForCurrentProcess()-> |
| 582 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | 575 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); |
| 583 if (value == "0") { | 576 if (value == "0") { |
| 584 navigation_overlay_.reset(); | 577 navigation_overlay_.reset(); |
| 585 return; | 578 return; |
| 586 } | 579 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 880 |
| 888 void WebContentsViewAura::StartDragging( | 881 void WebContentsViewAura::StartDragging( |
| 889 const DropData& drop_data, | 882 const DropData& drop_data, |
| 890 blink::WebDragOperationsMask operations, | 883 blink::WebDragOperationsMask operations, |
| 891 const gfx::ImageSkia& image, | 884 const gfx::ImageSkia& image, |
| 892 const gfx::Vector2d& image_offset, | 885 const gfx::Vector2d& image_offset, |
| 893 const DragEventSourceInfo& event_info, | 886 const DragEventSourceInfo& event_info, |
| 894 RenderWidgetHostImpl* source_rwh) { | 887 RenderWidgetHostImpl* source_rwh) { |
| 895 aura::Window* root_window = GetNativeView()->GetRootWindow(); | 888 aura::Window* root_window = GetNativeView()->GetRootWindow(); |
| 896 if (!aura::client::GetDragDropClient(root_window)) { | 889 if (!aura::client::GetDragDropClient(root_window)) { |
| 897 web_contents_->SystemDragEnded(); | 890 web_contents_->SystemDragEnded(source_rwh); |
| 898 return; | 891 return; |
| 899 } | 892 } |
| 900 | 893 |
| 901 drag_start_rwh_ = source_rwh->GetWeakPtr(); | 894 drag_start_rwh_ = source_rwh->GetWeakPtr(); |
| 902 | 895 |
| 903 ui::TouchSelectionController* selection_controller = GetSelectionController(); | 896 ui::TouchSelectionController* selection_controller = GetSelectionController(); |
| 904 if (selection_controller) | 897 if (selection_controller) |
| 905 selection_controller->HideAndDisallowShowingAutomatically(); | 898 selection_controller->HideAndDisallowShowingAutomatically(); |
| 906 std::unique_ptr<ui::OSExchangeData::Provider> provider = | 899 std::unique_ptr<ui::OSExchangeData::Provider> provider = |
| 907 ui::OSExchangeDataProviderFactory::CreateProvider(); | 900 ui::OSExchangeDataProviderFactory::CreateProvider(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 936 // not safe to access any class members in this case since |this| may already | 929 // not safe to access any class members in this case since |this| may already |
| 937 // be destroyed. The local variable |drag_source| will still be valid though, | 930 // be destroyed. The local variable |drag_source| will still be valid though, |
| 938 // so we can use it to determine if the window is gone. | 931 // so we can use it to determine if the window is gone. |
| 939 if (!drag_source->window()) { | 932 if (!drag_source->window()) { |
| 940 // Note that in this case, we don't need to call SystemDragEnded() since the | 933 // Note that in this case, we don't need to call SystemDragEnded() since the |
| 941 // renderer is going away. | 934 // renderer is going away. |
| 942 return; | 935 return; |
| 943 } | 936 } |
| 944 | 937 |
| 945 EndDrag(ConvertToWeb(result_op)); | 938 EndDrag(ConvertToWeb(result_op)); |
| 946 web_contents_->SystemDragEnded(); | 939 web_contents_->SystemDragEnded(source_rwh); |
| 947 } | 940 } |
| 948 | 941 |
| 949 void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { | 942 void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { |
| 950 current_drag_op_ = operation; | 943 current_drag_op_ = operation; |
| 951 } | 944 } |
| 952 | 945 |
| 953 void WebContentsViewAura::GotFocus() { | 946 void WebContentsViewAura::GotFocus() { |
| 954 web_contents_->NotifyWebContentsFocused(); | 947 web_contents_->NotifyWebContentsFocused(); |
| 955 } | 948 } |
| 956 | 949 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 bool allow_multiple_selection) { | 1242 bool allow_multiple_selection) { |
| 1250 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1243 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
| 1251 } | 1244 } |
| 1252 | 1245 |
| 1253 void WebContentsViewAura::HidePopupMenu() { | 1246 void WebContentsViewAura::HidePopupMenu() { |
| 1254 NOTIMPLEMENTED(); | 1247 NOTIMPLEMENTED(); |
| 1255 } | 1248 } |
| 1256 #endif | 1249 #endif |
| 1257 | 1250 |
| 1258 } // namespace content | 1251 } // namespace content |
| OLD | NEW |