Chromium Code Reviews| 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 if (drag_start_rwh_) { |
|
dcheng
2016/11/17 19:59:01
Let's centralize the null checks in WebContents, p
paulmeyer
2016/11/17 20:46:43
Done.
| |
| 566 return; | 566 // TODO(paulmeyer): In the OOPIF case, should |client_loc| be converted to |
| 567 | 567 // the coordinates local to |drag_start_rwh_|? See crbug.com/647249. |
| 568 if (drag_start_rwh_.get() == | |
| 569 web_contents_->GetRenderViewHost()->GetWidget()) { | |
| 570 web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.x(), | 568 web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.x(), |
| 571 screen_loc.x(), screen_loc.y(), ops); | 569 screen_loc.x(), screen_loc.y(), ops, |
| 570 drag_start_rwh_.get()); | |
| 572 } | 571 } |
| 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 } | 572 } |
| 578 | 573 |
| 579 void WebContentsViewAura::InstallOverscrollControllerDelegate( | 574 void WebContentsViewAura::InstallOverscrollControllerDelegate( |
| 580 RenderWidgetHostViewAura* view) { | 575 RenderWidgetHostViewAura* view) { |
| 581 const std::string value = base::CommandLine::ForCurrentProcess()-> | 576 const std::string value = base::CommandLine::ForCurrentProcess()-> |
| 582 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); | 577 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation); |
| 583 if (value == "0") { | 578 if (value == "0") { |
| 584 navigation_overlay_.reset(); | 579 navigation_overlay_.reset(); |
| 585 return; | 580 return; |
| 586 } | 581 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 887 | 882 |
| 888 void WebContentsViewAura::StartDragging( | 883 void WebContentsViewAura::StartDragging( |
| 889 const DropData& drop_data, | 884 const DropData& drop_data, |
| 890 blink::WebDragOperationsMask operations, | 885 blink::WebDragOperationsMask operations, |
| 891 const gfx::ImageSkia& image, | 886 const gfx::ImageSkia& image, |
| 892 const gfx::Vector2d& image_offset, | 887 const gfx::Vector2d& image_offset, |
| 893 const DragEventSourceInfo& event_info, | 888 const DragEventSourceInfo& event_info, |
| 894 RenderWidgetHostImpl* source_rwh) { | 889 RenderWidgetHostImpl* source_rwh) { |
| 895 aura::Window* root_window = GetNativeView()->GetRootWindow(); | 890 aura::Window* root_window = GetNativeView()->GetRootWindow(); |
| 896 if (!aura::client::GetDragDropClient(root_window)) { | 891 if (!aura::client::GetDragDropClient(root_window)) { |
| 897 web_contents_->SystemDragEnded(); | 892 web_contents_->SystemDragEnded(source_rwh); |
| 898 return; | 893 return; |
| 899 } | 894 } |
| 900 | 895 |
| 901 drag_start_rwh_ = source_rwh->GetWeakPtr(); | 896 drag_start_rwh_ = source_rwh->GetWeakPtr(); |
| 902 | 897 |
| 903 ui::TouchSelectionController* selection_controller = GetSelectionController(); | 898 ui::TouchSelectionController* selection_controller = GetSelectionController(); |
| 904 if (selection_controller) | 899 if (selection_controller) |
| 905 selection_controller->HideAndDisallowShowingAutomatically(); | 900 selection_controller->HideAndDisallowShowingAutomatically(); |
| 906 std::unique_ptr<ui::OSExchangeData::Provider> provider = | 901 std::unique_ptr<ui::OSExchangeData::Provider> provider = |
| 907 ui::OSExchangeDataProviderFactory::CreateProvider(); | 902 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 | 931 // 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, | 932 // 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. | 933 // so we can use it to determine if the window is gone. |
| 939 if (!drag_source->window()) { | 934 if (!drag_source->window()) { |
| 940 // Note that in this case, we don't need to call SystemDragEnded() since the | 935 // Note that in this case, we don't need to call SystemDragEnded() since the |
| 941 // renderer is going away. | 936 // renderer is going away. |
| 942 return; | 937 return; |
| 943 } | 938 } |
| 944 | 939 |
| 945 EndDrag(ConvertToWeb(result_op)); | 940 EndDrag(ConvertToWeb(result_op)); |
| 946 web_contents_->SystemDragEnded(); | 941 web_contents_->SystemDragEnded(source_rwh); |
| 947 } | 942 } |
| 948 | 943 |
| 949 void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { | 944 void WebContentsViewAura::UpdateDragCursor(blink::WebDragOperation operation) { |
| 950 current_drag_op_ = operation; | 945 current_drag_op_ = operation; |
| 951 } | 946 } |
| 952 | 947 |
| 953 void WebContentsViewAura::GotFocus() { | 948 void WebContentsViewAura::GotFocus() { |
| 954 web_contents_->NotifyWebContentsFocused(); | 949 web_contents_->NotifyWebContentsFocused(); |
| 955 } | 950 } |
| 956 | 951 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1249 bool allow_multiple_selection) { | 1244 bool allow_multiple_selection) { |
| 1250 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1245 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
| 1251 } | 1246 } |
| 1252 | 1247 |
| 1253 void WebContentsViewAura::HidePopupMenu() { | 1248 void WebContentsViewAura::HidePopupMenu() { |
| 1254 NOTIMPLEMENTED(); | 1249 NOTIMPLEMENTED(); |
| 1255 } | 1250 } |
| 1256 #endif | 1251 #endif |
| 1257 | 1252 |
| 1258 } // namespace content | 1253 } // namespace content |
| OLD | NEW |