| 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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); | 2716 ui::SnapLayerToPhysicalPixelBoundary(snapped->layer(), window_->layer()); |
| 2717 | 2717 |
| 2718 has_snapped_to_boundary_ = true; | 2718 has_snapped_to_boundary_ = true; |
| 2719 } | 2719 } |
| 2720 | 2720 |
| 2721 bool RenderWidgetHostViewAura::OnShowContextMenu( | 2721 bool RenderWidgetHostViewAura::OnShowContextMenu( |
| 2722 const ContextMenuParams& params) { | 2722 const ContextMenuParams& params) { |
| 2723 #if defined(OS_WIN) | 2723 #if defined(OS_WIN) |
| 2724 last_context_menu_params_.reset(); | 2724 last_context_menu_params_.reset(); |
| 2725 | 2725 |
| 2726 if (params.source_type == ui::MENU_SOURCE_TOUCH) { | 2726 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS) { |
| 2727 last_context_menu_params_.reset(new ContextMenuParams); | 2727 last_context_menu_params_.reset(new ContextMenuParams); |
| 2728 *last_context_menu_params_ = params; | 2728 *last_context_menu_params_ = params; |
| 2729 return false; | 2729 return false; |
| 2730 } | 2730 } |
| 2731 showing_context_menu_ = true; | 2731 showing_context_menu_ = true; |
| 2732 #endif | 2732 #endif |
| 2733 return true; | 2733 return true; |
| 2734 } | 2734 } |
| 2735 | 2735 |
| 2736 void RenderWidgetHostViewAura::SetSelectionControllerClientForTest( | 2736 void RenderWidgetHostViewAura::SetSelectionControllerClientForTest( |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 #if defined(OS_WIN) | 2946 #if defined(OS_WIN) |
| 2947 case ui::ET_GESTURE_LONG_TAP: { | 2947 case ui::ET_GESTURE_LONG_TAP: { |
| 2948 if (!last_context_menu_params_) | 2948 if (!last_context_menu_params_) |
| 2949 break; | 2949 break; |
| 2950 | 2950 |
| 2951 scoped_ptr<ContextMenuParams> context_menu_params = | 2951 scoped_ptr<ContextMenuParams> context_menu_params = |
| 2952 std::move(last_context_menu_params_); | 2952 std::move(last_context_menu_params_); |
| 2953 | 2953 |
| 2954 // On Windows we want to display the context menu when the long press | 2954 // On Windows we want to display the context menu when the long press |
| 2955 // gesture is released. To achieve that, we switch the saved context | 2955 // gesture is released. To achieve that, we switch the saved context |
| 2956 // menu params source type to MENU_SOURCE_MOUSE. This is to ensure that | 2956 // menu params source type to MENU_SOURCE_TOUCH. This is to ensure that |
| 2957 // the RenderWidgetHostViewAura::OnShowContextMenu function which is | 2957 // the RenderWidgetHostViewAura::OnShowContextMenu function which is |
| 2958 // called from the ShowContextMenu call below, does not treat it as | 2958 // called from the ShowContextMenu call below, does not treat it as |
| 2959 // a context menu request coming in from touch. | 2959 // a context menu request coming in from the long press gesture. |
| 2960 DCHECK(context_menu_params->source_type == ui::MENU_SOURCE_TOUCH); | 2960 DCHECK(context_menu_params->source_type == ui::MENU_SOURCE_LONG_PRESS); |
| 2961 context_menu_params->source_type = ui::MENU_SOURCE_MOUSE; | 2961 context_menu_params->source_type = ui::MENU_SOURCE_TOUCH; |
| 2962 | 2962 |
| 2963 RenderViewHostDelegateView* delegate_view = | 2963 RenderViewHostDelegateView* delegate_view = |
| 2964 GetRenderViewHostDelegateView(); | 2964 GetRenderViewHostDelegateView(); |
| 2965 if (delegate_view) | 2965 if (delegate_view) |
| 2966 delegate_view->ShowContextMenu(GetFocusedFrame(), | 2966 delegate_view->ShowContextMenu(GetFocusedFrame(), |
| 2967 *context_menu_params); | 2967 *context_menu_params); |
| 2968 | 2968 |
| 2969 event->SetHandled(); | 2969 event->SetHandled(); |
| 2970 // WARNING: we may have been deleted during the call to ShowContextMenu(). | 2970 // WARNING: we may have been deleted during the call to ShowContextMenu(). |
| 2971 break; | 2971 break; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 | 3078 |
| 3079 //////////////////////////////////////////////////////////////////////////////// | 3079 //////////////////////////////////////////////////////////////////////////////// |
| 3080 // RenderWidgetHostViewBase, public: | 3080 // RenderWidgetHostViewBase, public: |
| 3081 | 3081 |
| 3082 // static | 3082 // static |
| 3083 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3083 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3084 GetScreenInfoForWindow(results, NULL); | 3084 GetScreenInfoForWindow(results, NULL); |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 } // namespace content | 3087 } // namespace content |
| OLD | NEW |