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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 } | 1010 } |
1010 | 1011 |
1011 void View::OnTouchEvent(ui::TouchEvent* event) { | 1012 void View::OnTouchEvent(ui::TouchEvent* event) { |
1012 NOTREACHED() << "Views should not receive touch events."; | 1013 NOTREACHED() << "Views should not receive touch events."; |
1013 } | 1014 } |
1014 | 1015 |
1015 void View::OnGestureEvent(ui::GestureEvent* event) { | 1016 void View::OnGestureEvent(ui::GestureEvent* event) { |
1016 } | 1017 } |
1017 | 1018 |
1018 ui::TextInputClient* View::GetTextInputClient() { | 1019 ui::TextInputClient* View::GetTextInputClient() { |
1019 return NULL; | 1020 return nullptr; |
1020 } | 1021 } |
1021 | 1022 |
1022 InputMethod* View::GetInputMethod() { | 1023 ui::InputMethod* View::GetInputMethod() { |
1023 Widget* widget = GetWidget(); | 1024 Widget* widget = GetWidget(); |
1024 return widget ? widget->GetInputMethod() : NULL; | 1025 return widget ? widget->GetInputMethod() : nullptr; |
1025 } | 1026 } |
1026 | 1027 |
1027 const InputMethod* View::GetInputMethod() const { | 1028 const ui::InputMethod* View::GetInputMethod() const { |
1028 const Widget* widget = GetWidget(); | 1029 Widget* widget = const_cast<Widget*>(GetWidget()); |
1029 return widget ? widget->GetInputMethod() : NULL; | 1030 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) |
| 1031 : nullptr; |
1030 } | 1032 } |
1031 | 1033 |
1032 scoped_ptr<ViewTargeter> | 1034 scoped_ptr<ViewTargeter> |
1033 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { | 1035 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { |
1034 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); | 1036 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); |
1035 targeter_ = targeter.Pass(); | 1037 targeter_ = targeter.Pass(); |
1036 return old_targeter.Pass(); | 1038 return old_targeter.Pass(); |
1037 } | 1039 } |
1038 | 1040 |
1039 ViewTargeter* View::GetEffectiveViewTargeter() const { | 1041 ViewTargeter* View::GetEffectiveViewTargeter() const { |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 // Message the RootView to do the drag and drop. That way if we're removed | 2369 // Message the RootView to do the drag and drop. That way if we're removed |
2368 // the RootView can detect it and avoid calling us back. | 2370 // the RootView can detect it and avoid calling us back. |
2369 gfx::Point widget_location(event.location()); | 2371 gfx::Point widget_location(event.location()); |
2370 ConvertPointToWidget(this, &widget_location); | 2372 ConvertPointToWidget(this, &widget_location); |
2371 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2373 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2372 // WARNING: we may have been deleted. | 2374 // WARNING: we may have been deleted. |
2373 return true; | 2375 return true; |
2374 } | 2376 } |
2375 | 2377 |
2376 } // namespace views | 2378 } // namespace views |
OLD | NEW |