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/window.h" |
10 #include "ui/aura/client/cursor_client.h" | 11 #include "ui/aura/client/cursor_client.h" |
11 #include "ui/aura/env.h" | 12 #include "ui/aura/env.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.can_activate = false; | 77 params.can_activate = false; |
78 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 78 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
79 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 79 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
80 params.parent = context; | 80 params.parent = context; |
81 params.delegate = widget_delegate; | 81 params.delegate = widget_delegate; |
82 widget->Init(params); | 82 widget->Init(params); |
83 SetShadowType(widget->GetNativeView(), wm::SHADOW_TYPE_NONE); | 83 widget->SetHasActivationShadow(false); |
84 return widget; | 84 return widget; |
85 } | 85 } |
86 | 86 |
87 gfx::Image* GetHandleImage() { | 87 gfx::Image* GetHandleImage() { |
88 static gfx::Image* handle_image = NULL; | 88 static gfx::Image* handle_image = NULL; |
89 if (!handle_image) { | 89 if (!handle_image) { |
90 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 90 handle_image = &ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
91 IDR_TEXT_SELECTION_HANDLE); | 91 IDR_TEXT_SELECTION_HANDLE); |
92 } | 92 } |
93 return handle_image; | 93 return handle_image; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { | 623 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { |
624 return selection_handle_2_->IsWidgetVisible(); | 624 return selection_handle_2_->IsWidgetVisible(); |
625 } | 625 } |
626 | 626 |
627 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { | 627 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { |
628 return cursor_handle_->IsWidgetVisible(); | 628 return cursor_handle_->IsWidgetVisible(); |
629 } | 629 } |
630 | 630 |
631 } // namespace views | 631 } // namespace views |
OLD | NEW |