| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| 7 #pragma once |
| 8 |
| 9 #if defined(OS_MACOSX) |
| 10 #include <OpenGL/OpenGL.h> |
| 11 #endif |
| 12 |
| 13 #if defined(TOOLKIT_USES_GTK) |
| 14 #include <gdk/gdk.h> |
| 15 #endif |
| 16 |
| 17 #include <string> |
| 18 #include <vector> |
| 19 |
| 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/callback_forward.h" |
| 22 #include "content/common/content_export.h" |
| 23 #include "content/port/browser/render_widget_host_view_port.h" |
| 24 #include "ui/base/range/range.h" |
| 25 |
| 26 namespace content { |
| 27 |
| 28 // Basic implementation shared by concrete RenderWidgetHostView |
| 29 // subclasses. |
| 30 // |
| 31 // Note that nothing should use this class, except concrete subclasses |
| 32 // that are deriving from it, and code that is written specifically to |
| 33 // use one of these concrete subclasses (i.e. platform-specific code). |
| 34 // |
| 35 // To enable embedders that add ports, everything else in content/ |
| 36 // should use the RenderWidgetHostViewPort interface. |
| 37 class CONTENT_EXPORT RenderWidgetHostViewBase |
| 38 : public RenderWidgetHostViewPort { |
| 39 public: |
| 40 virtual ~RenderWidgetHostViewBase(); |
| 41 |
| 42 // RenderWidgetHostViewPort implementation. |
| 43 virtual void SelectionChanged(const string16& text, |
| 44 size_t offset, |
| 45 const ui::Range& range) OVERRIDE; |
| 46 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 47 virtual const SkBitmap& GetBackground() OVERRIDE; |
| 48 virtual bool IsShowingContextMenu() const OVERRIDE; |
| 49 virtual void SetShowingContextMenu(bool showing_menu) OVERRIDE; |
| 50 virtual BrowserAccessibilityManager* |
| 51 GetBrowserAccessibilityManager() const OVERRIDE; |
| 52 virtual bool IsMouseLocked() OVERRIDE; |
| 53 virtual void SetPopupType(WebKit::WebPopupType popup_type) OVERRIDE; |
| 54 virtual WebKit::WebPopupType GetPopupType() OVERRIDE; |
| 55 |
| 56 void SetBrowserAccessibilityManager(BrowserAccessibilityManager* manager); |
| 57 |
| 58 protected: |
| 59 // Interface class only, do not construct. |
| 60 RenderWidgetHostViewBase(); |
| 61 |
| 62 // Whether this view is a popup and what kind of popup it is (select, |
| 63 // autofill...). |
| 64 WebKit::WebPopupType popup_type_; |
| 65 |
| 66 // A custom background to paint behind the web content. This will be tiled |
| 67 // horizontally. Can be null, in which case we fall back to painting white. |
| 68 SkBitmap background_; |
| 69 |
| 70 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
| 71 // are still generated. However, the position they report is the last known |
| 72 // mouse position just as mouse lock was entered; the movement they report |
| 73 // indicates what the change in position of the mouse would be had it not been |
| 74 // locked. |
| 75 bool mouse_locked_; |
| 76 |
| 77 // Whether we are showing a context menu. |
| 78 bool showing_context_menu_; |
| 79 |
| 80 // A buffer containing the text inside and around the current selection range. |
| 81 string16 selection_text_; |
| 82 |
| 83 // The offset of the text stored in |selection_text_| relative to the start of |
| 84 // the web page. |
| 85 size_t selection_text_offset_; |
| 86 |
| 87 // The current selection range relative to the start of the web page. |
| 88 ui::Range selection_range_; |
| 89 |
| 90 private: |
| 91 // Manager of the tree representation of the WebKit render tree. |
| 92 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; |
| 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
| 95 }; |
| 96 |
| 97 } // namespace content |
| 98 |
| 99 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| OLD | NEW |