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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "third_party/skia/include/core/SkRect.h" | 18 #include "third_party/skia/include/core/SkRect.h" |
19 #include "ui/accessibility/ax_enums.h" | 19 #include "ui/accessibility/ax_enums.h" |
20 #include "ui/base/cursor/cursor.h" | 20 #include "ui/base/cursor/cursor.h" |
21 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
| 22 #include "ui/base/ime/input_method.h" |
22 #include "ui/compositor/clip_transform_recorder.h" | 23 #include "ui/compositor/clip_transform_recorder.h" |
23 #include "ui/compositor/compositor.h" | 24 #include "ui/compositor/compositor.h" |
24 #include "ui/compositor/dip_util.h" | 25 #include "ui/compositor/dip_util.h" |
25 #include "ui/compositor/layer.h" | 26 #include "ui/compositor/layer.h" |
26 #include "ui/compositor/layer_animator.h" | 27 #include "ui/compositor/layer_animator.h" |
27 #include "ui/compositor/paint_context.h" | 28 #include "ui/compositor/paint_context.h" |
28 #include "ui/compositor/paint_recorder.h" | 29 #include "ui/compositor/paint_recorder.h" |
29 #include "ui/events/event_target_iterator.h" | 30 #include "ui/events/event_target_iterator.h" |
30 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
31 #include "ui/gfx/geometry/point3_f.h" | 32 #include "ui/gfx/geometry/point3_f.h" |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 void View::OnScrollEvent(ui::ScrollEvent* event) { | 1004 void View::OnScrollEvent(ui::ScrollEvent* event) { |
1004 } | 1005 } |
1005 | 1006 |
1006 void View::OnTouchEvent(ui::TouchEvent* event) { | 1007 void View::OnTouchEvent(ui::TouchEvent* event) { |
1007 NOTREACHED() << "Views should not receive touch events."; | 1008 NOTREACHED() << "Views should not receive touch events."; |
1008 } | 1009 } |
1009 | 1010 |
1010 void View::OnGestureEvent(ui::GestureEvent* event) { | 1011 void View::OnGestureEvent(ui::GestureEvent* event) { |
1011 } | 1012 } |
1012 | 1013 |
1013 ui::TextInputClient* View::GetTextInputClient() { | 1014 const ui::InputMethod* View::GetInputMethod() const { |
1014 return NULL; | 1015 Widget* widget = const_cast<Widget*>(GetWidget()); |
1015 } | 1016 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) |
1016 | 1017 : nullptr; |
1017 InputMethod* View::GetInputMethod() { | |
1018 Widget* widget = GetWidget(); | |
1019 return widget ? widget->GetInputMethod() : NULL; | |
1020 } | |
1021 | |
1022 const InputMethod* View::GetInputMethod() const { | |
1023 const Widget* widget = GetWidget(); | |
1024 return widget ? widget->GetInputMethod() : NULL; | |
1025 } | 1018 } |
1026 | 1019 |
1027 scoped_ptr<ViewTargeter> | 1020 scoped_ptr<ViewTargeter> |
1028 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { | 1021 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { |
1029 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); | 1022 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); |
1030 targeter_ = targeter.Pass(); | 1023 targeter_ = targeter.Pass(); |
1031 return old_targeter.Pass(); | 1024 return old_targeter.Pass(); |
1032 } | 1025 } |
1033 | 1026 |
1034 ViewTargeter* View::GetEffectiveViewTargeter() const { | 1027 ViewTargeter* View::GetEffectiveViewTargeter() const { |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 // Message the RootView to do the drag and drop. That way if we're removed | 2349 // Message the RootView to do the drag and drop. That way if we're removed |
2357 // the RootView can detect it and avoid calling us back. | 2350 // the RootView can detect it and avoid calling us back. |
2358 gfx::Point widget_location(event.location()); | 2351 gfx::Point widget_location(event.location()); |
2359 ConvertPointToWidget(this, &widget_location); | 2352 ConvertPointToWidget(this, &widget_location); |
2360 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2353 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2361 // WARNING: we may have been deleted. | 2354 // WARNING: we may have been deleted. |
2362 return true; | 2355 return true; |
2363 } | 2356 } |
2364 | 2357 |
2365 } // namespace views | 2358 } // namespace views |
OLD | NEW |