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