| 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 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public: | 48 public: |
| 49 WebContentsViewAura(WebContentsImpl* web_contents, | 49 WebContentsViewAura(WebContentsImpl* web_contents, |
| 50 WebContentsViewDelegate* delegate); | 50 WebContentsViewDelegate* delegate); |
| 51 | 51 |
| 52 CONTENT_EXPORT void SetTouchEditableForTest( | 52 CONTENT_EXPORT void SetTouchEditableForTest( |
| 53 TouchEditableImplAura* touch_editable); | 53 TouchEditableImplAura* touch_editable); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 class WindowObserver; | 56 class WindowObserver; |
| 57 | 57 |
| 58 virtual ~WebContentsViewAura(); | 58 ~WebContentsViewAura() override; |
| 59 | 59 |
| 60 void SizeChangedCommon(const gfx::Size& size); | 60 void SizeChangedCommon(const gfx::Size& size); |
| 61 | 61 |
| 62 void EndDrag(blink::WebDragOperationsMask ops); | 62 void EndDrag(blink::WebDragOperationsMask ops); |
| 63 | 63 |
| 64 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); | 64 void InstallOverscrollControllerDelegate(RenderWidgetHostViewAura* view); |
| 65 | 65 |
| 66 // Creates and sets up the overlay window that will be displayed during the | 66 // Creates and sets up the overlay window that will be displayed during the |
| 67 // overscroll gesture. | 67 // overscroll gesture. |
| 68 void PrepareOverscrollWindow(); | 68 void PrepareOverscrollWindow(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 96 | 96 |
| 97 // Changes the brightness of the layer depending on the amount of horizontal | 97 // Changes the brightness of the layer depending on the amount of horizontal |
| 98 // overscroll (|delta_x|, in pixels). | 98 // overscroll (|delta_x|, in pixels). |
| 99 void UpdateOverscrollWindowBrightness(float delta_x); | 99 void UpdateOverscrollWindowBrightness(float delta_x); |
| 100 | 100 |
| 101 void AttachTouchEditableToRenderView(); | 101 void AttachTouchEditableToRenderView(); |
| 102 | 102 |
| 103 void OverscrollUpdateForWebContentsDelegate(float delta_y); | 103 void OverscrollUpdateForWebContentsDelegate(float delta_y); |
| 104 | 104 |
| 105 // Overridden from WebContentsView: | 105 // Overridden from WebContentsView: |
| 106 virtual gfx::NativeView GetNativeView() const override; | 106 gfx::NativeView GetNativeView() const override; |
| 107 virtual gfx::NativeView GetContentNativeView() const override; | 107 gfx::NativeView GetContentNativeView() const override; |
| 108 virtual gfx::NativeWindow GetTopLevelNativeWindow() const override; | 108 gfx::NativeWindow GetTopLevelNativeWindow() const override; |
| 109 virtual void GetContainerBounds(gfx::Rect *out) const override; | 109 void GetContainerBounds(gfx::Rect* out) const override; |
| 110 virtual void SizeContents(const gfx::Size& size) override; | 110 void SizeContents(const gfx::Size& size) override; |
| 111 virtual void Focus() override; | 111 void Focus() override; |
| 112 virtual void SetInitialFocus() override; | 112 void SetInitialFocus() override; |
| 113 virtual void StoreFocus() override; | 113 void StoreFocus() override; |
| 114 virtual void RestoreFocus() override; | 114 void RestoreFocus() override; |
| 115 virtual DropData* GetDropData() const override; | 115 DropData* GetDropData() const override; |
| 116 virtual gfx::Rect GetViewBounds() const override; | 116 gfx::Rect GetViewBounds() const override; |
| 117 virtual void CreateView( | 117 void CreateView(const gfx::Size& initial_size, |
| 118 const gfx::Size& initial_size, gfx::NativeView context) override; | 118 gfx::NativeView context) override; |
| 119 virtual RenderWidgetHostViewBase* CreateViewForWidget( | 119 RenderWidgetHostViewBase* CreateViewForWidget( |
| 120 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) override; | 120 RenderWidgetHost* render_widget_host, |
| 121 virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( | 121 bool is_guest_view_hack) override; |
| 122 RenderWidgetHostViewBase* CreateViewForPopupWidget( |
| 122 RenderWidgetHost* render_widget_host) override; | 123 RenderWidgetHost* render_widget_host) override; |
| 123 virtual void SetPageTitle(const base::string16& title) override; | 124 void SetPageTitle(const base::string16& title) override; |
| 124 virtual void RenderViewCreated(RenderViewHost* host) override; | 125 void RenderViewCreated(RenderViewHost* host) override; |
| 125 virtual void RenderViewSwappedIn(RenderViewHost* host) override; | 126 void RenderViewSwappedIn(RenderViewHost* host) override; |
| 126 virtual void SetOverscrollControllerEnabled(bool enabled) override; | 127 void SetOverscrollControllerEnabled(bool enabled) override; |
| 127 | 128 |
| 128 // Overridden from RenderViewHostDelegateView: | 129 // Overridden from RenderViewHostDelegateView: |
| 129 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, | 130 void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 130 const ContextMenuParams& params) override; | 131 const ContextMenuParams& params) override; |
| 131 virtual void StartDragging(const DropData& drop_data, | 132 void StartDragging(const DropData& drop_data, |
| 132 blink::WebDragOperationsMask operations, | 133 blink::WebDragOperationsMask operations, |
| 133 const gfx::ImageSkia& image, | 134 const gfx::ImageSkia& image, |
| 134 const gfx::Vector2d& image_offset, | 135 const gfx::Vector2d& image_offset, |
| 135 const DragEventSourceInfo& event_info) override; | 136 const DragEventSourceInfo& event_info) override; |
| 136 virtual void UpdateDragCursor(blink::WebDragOperation operation) override; | 137 void UpdateDragCursor(blink::WebDragOperation operation) override; |
| 137 virtual void GotFocus() override; | 138 void GotFocus() override; |
| 138 virtual void TakeFocus(bool reverse) override; | 139 void TakeFocus(bool reverse) override; |
| 139 virtual void ShowDisambiguationPopup( | 140 void ShowDisambiguationPopup( |
| 140 const gfx::Rect& target_rect, | 141 const gfx::Rect& target_rect, |
| 141 const SkBitmap& zoomed_bitmap, | 142 const SkBitmap& zoomed_bitmap, |
| 142 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, | 143 const base::Callback<void(ui::GestureEvent*)>& gesture_cb, |
| 143 const base::Callback<void(ui::MouseEvent*)>& mouse_cb) override; | 144 const base::Callback<void(ui::MouseEvent*)>& mouse_cb) override; |
| 144 virtual void HideDisambiguationPopup() override; | 145 void HideDisambiguationPopup() override; |
| 145 | 146 |
| 146 // Overridden from OverscrollControllerDelegate: | 147 // Overridden from OverscrollControllerDelegate: |
| 147 virtual gfx::Rect GetVisibleBounds() const override; | 148 gfx::Rect GetVisibleBounds() const override; |
| 148 virtual bool OnOverscrollUpdate(float delta_x, float delta_y) override; | 149 bool OnOverscrollUpdate(float delta_x, float delta_y) override; |
| 149 virtual void OnOverscrollComplete(OverscrollMode overscroll_mode) override; | 150 void OnOverscrollComplete(OverscrollMode overscroll_mode) override; |
| 150 virtual void OnOverscrollModeChange(OverscrollMode old_mode, | 151 void OnOverscrollModeChange(OverscrollMode old_mode, |
| 151 OverscrollMode new_mode) override; | 152 OverscrollMode new_mode) override; |
| 152 | 153 |
| 153 // Overridden from ui::ImplicitAnimationObserver: | 154 // Overridden from ui::ImplicitAnimationObserver: |
| 154 virtual void OnImplicitAnimationsCompleted() override; | 155 void OnImplicitAnimationsCompleted() override; |
| 155 | 156 |
| 156 // Overridden from aura::WindowDelegate: | 157 // Overridden from aura::WindowDelegate: |
| 157 virtual gfx::Size GetMinimumSize() const override; | 158 gfx::Size GetMinimumSize() const override; |
| 158 virtual gfx::Size GetMaximumSize() const override; | 159 gfx::Size GetMaximumSize() const override; |
| 159 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 160 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 160 const gfx::Rect& new_bounds) override; | 161 const gfx::Rect& new_bounds) override; |
| 161 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; | 162 gfx::NativeCursor GetCursor(const gfx::Point& point) override; |
| 162 virtual int GetNonClientComponent(const gfx::Point& point) const override; | 163 int GetNonClientComponent(const gfx::Point& point) const override; |
| 163 virtual bool ShouldDescendIntoChildForEventHandling( | 164 bool ShouldDescendIntoChildForEventHandling( |
| 164 aura::Window* child, | 165 aura::Window* child, |
| 165 const gfx::Point& location) override; | 166 const gfx::Point& location) override; |
| 166 virtual bool CanFocus() override; | 167 bool CanFocus() override; |
| 167 virtual void OnCaptureLost() override; | 168 void OnCaptureLost() override; |
| 168 virtual void OnPaint(gfx::Canvas* canvas) override; | 169 void OnPaint(gfx::Canvas* canvas) override; |
| 169 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 170 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 170 virtual void OnWindowDestroying(aura::Window* window) override; | 171 void OnWindowDestroying(aura::Window* window) override; |
| 171 virtual void OnWindowDestroyed(aura::Window* window) override; | 172 void OnWindowDestroyed(aura::Window* window) override; |
| 172 virtual void OnWindowTargetVisibilityChanged(bool visible) override; | 173 void OnWindowTargetVisibilityChanged(bool visible) override; |
| 173 virtual bool HasHitTestMask() const override; | 174 bool HasHitTestMask() const override; |
| 174 virtual void GetHitTestMask(gfx::Path* mask) const override; | 175 void GetHitTestMask(gfx::Path* mask) const override; |
| 175 | 176 |
| 176 // Overridden from ui::EventHandler: | 177 // Overridden from ui::EventHandler: |
| 177 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 178 void OnKeyEvent(ui::KeyEvent* event) override; |
| 178 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 179 void OnMouseEvent(ui::MouseEvent* event) override; |
| 179 | 180 |
| 180 // Overridden from aura::client::DragDropDelegate: | 181 // Overridden from aura::client::DragDropDelegate: |
| 181 virtual void OnDragEntered(const ui::DropTargetEvent& event) override; | 182 void OnDragEntered(const ui::DropTargetEvent& event) override; |
| 182 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; | 183 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| 183 virtual void OnDragExited() override; | 184 void OnDragExited() override; |
| 184 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; | 185 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
| 185 | 186 |
| 186 // Overridden from aura::WindowObserver: | 187 // Overridden from aura::WindowObserver: |
| 187 virtual void OnWindowVisibilityChanged(aura::Window* window, | 188 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; |
| 188 bool visible) override; | |
| 189 | 189 |
| 190 // Update the web contents visiblity. | 190 // Update the web contents visiblity. |
| 191 void UpdateWebContentsVisibility(bool visible); | 191 void UpdateWebContentsVisibility(bool visible); |
| 192 | 192 |
| 193 scoped_ptr<aura::Window> window_; | 193 scoped_ptr<aura::Window> window_; |
| 194 | 194 |
| 195 // The window that shows the screenshot of the history page during an | 195 // The window that shows the screenshot of the history page during an |
| 196 // overscroll navigation gesture. | 196 // overscroll navigation gesture. |
| 197 scoped_ptr<aura::Window> overscroll_window_; | 197 scoped_ptr<aura::Window> overscroll_window_; |
| 198 | 198 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // On Windows we can run into problems if resources get released within the | 236 // On Windows we can run into problems if resources get released within the |
| 237 // initialization phase while the content (and its dimensions) are not known. | 237 // initialization phase while the content (and its dimensions) are not known. |
| 238 bool is_or_was_visible_; | 238 bool is_or_was_visible_; |
| 239 | 239 |
| 240 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 240 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace content | 243 } // namespace content |
| 244 | 244 |
| 245 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 245 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| OLD | NEW |