OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/views/touchui/touch_selection_controller_impl.h" | 5 #include "ui/views/touchui/touch_selection_controller_impl.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 12 #include "ui/aura/window.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/path.h" | 16 #include "ui/gfx/path.h" |
16 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
17 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
18 #include "ui/gfx/size.h" | 19 #include "ui/gfx/size.h" |
19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
20 #include "ui/wm/core/masked_window_targeter.h" | 21 #include "ui/wm/core/masked_window_targeter.h" |
21 #include "ui/wm/core/shadow_types.h" | |
22 #include "ui/wm/core/window_animations.h" | 22 #include "ui/wm/core/window_animations.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Constants defining the visual attributes of selection handles | 26 // Constants defining the visual attributes of selection handles |
27 const int kSelectionHandleLineWidth = 1; | 27 const int kSelectionHandleLineWidth = 1; |
28 const SkColor kSelectionHandleLineColor = | 28 const SkColor kSelectionHandleLineColor = |
29 SkColorSetRGB(0x42, 0x81, 0xf4); | 29 SkColorSetRGB(0x42, 0x81, 0xf4); |
30 | 30 |
31 // When a handle is dragged, the drag position reported to the client view is | 31 // When a handle is dragged, the drag position reported to the client view is |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // boundaries. | 68 // boundaries. |
69 const int kSelectionHandleBarBottomAllowance = 3; | 69 const int kSelectionHandleBarBottomAllowance = 3; |
70 | 70 |
71 // Creates a widget to host SelectionHandleView. | 71 // Creates a widget to host SelectionHandleView. |
72 views::Widget* CreateTouchSelectionPopupWidget( | 72 views::Widget* CreateTouchSelectionPopupWidget( |
73 gfx::NativeView context, | 73 gfx::NativeView context, |
74 views::WidgetDelegate* widget_delegate) { | 74 views::WidgetDelegate* widget_delegate) { |
75 views::Widget* widget = new views::Widget; | 75 views::Widget* widget = new views::Widget; |
76 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 76 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
77 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 77 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 78 params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; |
78 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 79 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
79 params.parent = context; | 80 params.parent = context; |
80 params.delegate = widget_delegate; | 81 params.delegate = widget_delegate; |
81 widget->Init(params); | 82 widget->Init(params); |
82 SetShadowType(widget->GetNativeView(), wm::SHADOW_TYPE_NONE); | |
83 return widget; | 83 return widget; |
84 } | 84 } |
85 | 85 |
86 gfx::Image* GetHandleImage() { | 86 gfx::Image* GetHandleImage() { |
87 static gfx::Image* handle_image = NULL; | 87 static gfx::Image* handle_image = NULL; |
88 if (!handle_image) { | 88 if (!handle_image) { |
89 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 89 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
90 IDR_TEXT_SELECTION_HANDLE); | 90 IDR_TEXT_SELECTION_HANDLE); |
91 } | 91 } |
92 return handle_image; | 92 return handle_image; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 621 |
622 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 622 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
623 return selection_handle_2_->IsWidgetVisible(); | 623 return selection_handle_2_->IsWidgetVisible(); |
624 } | 624 } |
625 | 625 |
626 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { | 626 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { |
627 return cursor_handle_->IsWidgetVisible(); | 627 return cursor_handle_->IsWidgetVisible(); |
628 } | 628 } |
629 | 629 |
630 } // namespace views | 630 } // namespace views |
OLD | NEW |