OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "content/browser/renderer_host/render_widget_host_view.h" | 15 #include "content/browser/renderer_host/render_widget_host_view.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 #include "views/controls/native/native_view_host.h" | 18 #include "views/controls/native/native_view_host.h" |
19 #include "views/events/event.h" | 19 #include "views/events/event.h" |
20 #include "views/ime/text_input_client.h" | 20 #include "views/ime/text_input_client.h" |
| 21 #include "views/touchui/touch_selection_controller.h" |
21 #include "views/view.h" | 22 #include "views/view.h" |
22 #include "webkit/glue/webcursor.h" | 23 #include "webkit/glue/webcursor.h" |
23 | 24 |
24 #if defined(TOUCH_UI) | 25 #if defined(TOUCH_UI) |
25 namespace ui { | 26 namespace ui { |
26 enum TouchStatus; | 27 enum TouchStatus; |
27 } | 28 } |
28 class AcceleratedSurfaceContainerTouch; | 29 class AcceleratedSurfaceContainerTouch; |
29 #endif | 30 #endif |
30 | 31 |
31 class RenderWidgetHost; | 32 class RenderWidgetHost; |
32 struct NativeWebKeyboardEvent; | 33 struct NativeWebKeyboardEvent; |
33 | 34 |
34 // ----------------------------------------------------------------------------- | 35 // ----------------------------------------------------------------------------- |
35 // See comments in render_widget_host_view.h about this class and its members. | 36 // See comments in render_widget_host_view.h about this class and its members. |
36 // ----------------------------------------------------------------------------- | 37 // ----------------------------------------------------------------------------- |
37 class RenderWidgetHostViewViews : public RenderWidgetHostView, | 38 class RenderWidgetHostViewViews : public RenderWidgetHostView, |
38 public views::View, | 39 public views::TouchSelectionClientView, |
39 public views::TextInputClient { | 40 public views::TextInputClient { |
40 public: | 41 public: |
41 // Internal class name. | 42 // Internal class name. |
42 static const char kViewClassName[]; | 43 static const char kViewClassName[]; |
43 | 44 |
44 explicit RenderWidgetHostViewViews(RenderWidgetHost* widget); | 45 explicit RenderWidgetHostViewViews(RenderWidgetHost* widget); |
45 virtual ~RenderWidgetHostViewViews(); | 46 virtual ~RenderWidgetHostViewViews(); |
46 | 47 |
47 // Initialize this object for use as a drawing area. | 48 // Initialize this object for use as a drawing area. |
48 void InitAsChild(); | 49 void InitAsChild(); |
(...skipping 23 matching lines...) Expand all Loading... |
72 const gfx::Rect& caret_rect) OVERRIDE; | 73 const gfx::Rect& caret_rect) OVERRIDE; |
73 virtual void ImeCancelComposition() OVERRIDE; | 74 virtual void ImeCancelComposition() OVERRIDE; |
74 virtual void DidUpdateBackingStore( | 75 virtual void DidUpdateBackingStore( |
75 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 76 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
76 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; | 77 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; |
77 virtual void RenderViewGone(base::TerminationStatus status, | 78 virtual void RenderViewGone(base::TerminationStatus status, |
78 int error_code) OVERRIDE; | 79 int error_code) OVERRIDE; |
79 virtual void Destroy() OVERRIDE; | 80 virtual void Destroy() OVERRIDE; |
80 virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE; | 81 virtual void SetTooltipText(const std::wstring& tooltip_text) OVERRIDE; |
81 virtual void SelectionChanged(const std::string& text, | 82 virtual void SelectionChanged(const std::string& text, |
82 const ui::Range& range) OVERRIDE; | 83 const ui::Range& range, |
| 84 const gfx::Point& start, |
| 85 const gfx::Point& end) OVERRIDE; |
83 virtual void ShowingContextMenu(bool showing) OVERRIDE; | 86 virtual void ShowingContextMenu(bool showing) OVERRIDE; |
84 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; | 87 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; |
85 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 88 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
86 #if defined(TOOLKIT_USES_GTK) | 89 #if defined(TOOLKIT_USES_GTK) |
87 virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE; | 90 virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE; |
88 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE; | 91 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE; |
89 #endif | 92 #endif |
90 virtual void SetVisuallyDeemphasized(const SkColor* color, | 93 virtual void SetVisuallyDeemphasized(const SkColor* color, |
91 bool animate) OVERRIDE; | 94 bool animate) OVERRIDE; |
92 #if defined(TOOLKIT_USES_GTK) | 95 #if defined(TOOLKIT_USES_GTK) |
93 virtual void AcceleratedCompositingActivated(bool activated) OVERRIDE; | 96 virtual void AcceleratedCompositingActivated(bool activated) OVERRIDE; |
94 #endif | 97 #endif |
95 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
96 virtual void WillWmDestroy() OVERRIDE; | 99 virtual void WillWmDestroy() OVERRIDE; |
97 virtual void ShowCompositorHostWindow(bool show) OVERRIDE; | 100 virtual void ShowCompositorHostWindow(bool show) OVERRIDE; |
98 #endif | 101 #endif |
99 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; | 102 virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; |
100 | 103 |
| 104 // Overridden from views::TouchSelectionClientView. |
| 105 virtual void SelectRect(const gfx::Point& start, |
| 106 const gfx::Point& end) OVERRIDE; |
| 107 |
| 108 // Overridden from ui::SimpleMenuModel::Delegate. |
| 109 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 110 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 111 virtual bool GetAcceleratorForCommandId( |
| 112 int command_id, |
| 113 ui::Accelerator* accelerator) OVERRIDE; |
| 114 virtual void ExecuteCommand(int command_id) OVERRIDE; |
| 115 |
101 // Overridden from views::View. | 116 // Overridden from views::View. |
102 virtual std::string GetClassName() const OVERRIDE; | 117 virtual std::string GetClassName() const OVERRIDE; |
103 virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE; | 118 virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE; |
104 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 119 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
105 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 120 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
106 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 121 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
107 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; | 122 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE; |
108 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 123 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
109 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 124 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
110 #if defined(TOUCH_UI) | 125 #if defined(TOUCH_UI) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ui::TextInputType text_input_type_; | 248 ui::TextInputType text_input_type_; |
234 | 249 |
235 // The current caret bounds. | 250 // The current caret bounds. |
236 gfx::Rect caret_bounds_; | 251 gfx::Rect caret_bounds_; |
237 | 252 |
238 // Indicates if there is onging composition text. | 253 // Indicates if there is onging composition text. |
239 bool has_composition_text_; | 254 bool has_composition_text_; |
240 | 255 |
241 string16 tooltip_text_; | 256 string16 tooltip_text_; |
242 | 257 |
| 258 scoped_ptr<views::TouchSelectionController> touch_selection_controller_; |
| 259 |
243 #if defined(TOUCH_UI) | 260 #if defined(TOUCH_UI) |
244 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerTouch> > | 261 std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerTouch> > |
245 accelerated_surface_containers_; | 262 accelerated_surface_containers_; |
246 #endif | 263 #endif |
247 | 264 |
248 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewViews); | 265 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewViews); |
249 }; | 266 }; |
250 | 267 |
251 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ | 268 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_VIEWS_H_ |
OLD | NEW |