| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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_MUS_H_ | |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MUS_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "build/build_config.h" | |
| 12 #include "content/browser/renderer_host/render_widget_host_view_base.h" | |
| 13 #include "content/public/browser/render_process_host_observer.h" | |
| 14 #include "services/ui/public/cpp/input_event_handler.h" | |
| 15 #include "services/ui/public/cpp/scoped_window_ptr.h" | |
| 16 #include "services/ui/public/cpp/window.h" | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class RenderWidgetHost; | |
| 21 class RenderWidgetHostImpl; | |
| 22 struct TextInputState; | |
| 23 | |
| 24 // See comments in render_widget_host_view.h about this class and its members. | |
| 25 // This version of RenderWidgetHostView is for builds of Chrome that run through | |
| 26 // the standalone service runner and use the Mandoline UI Service (Mus). Mus is | |
| 27 // responsible for windowing, compositing, and input event dispatch. The purpose | |
| 28 // of RenderWidgetHostViewMus is to manage the ui::Window owned by the content | |
| 29 // embedder. The browser is the owner of the ui::Window, controlling properties | |
| 30 // such as visibility, and bounds. Some aspects such as input, focus, and cursor | |
| 31 // are managed by Mus directly. Input event routing will be plumbed directly to | |
| 32 // the renderer from Mus. | |
| 33 class CONTENT_EXPORT RenderWidgetHostViewMus | |
| 34 : public RenderWidgetHostViewBase, | |
| 35 NON_EXPORTED_BASE(public ui::InputEventHandler) { | |
| 36 public: | |
| 37 RenderWidgetHostViewMus(ui::Window* parent_window, | |
| 38 RenderWidgetHostImpl* widget); | |
| 39 ~RenderWidgetHostViewMus() override; | |
| 40 | |
| 41 private: | |
| 42 // Set the bounds of the window and handle size changes. Assumes the caller | |
| 43 // has already adjusted the origin of |rect| to conform to whatever coordinate | |
| 44 // space is required by the aura::Window. | |
| 45 void InternalSetBounds(const gfx::Rect& rect); | |
| 46 | |
| 47 // RenderWidgetHostView implementation. | |
| 48 void InitAsChild(gfx::NativeView parent_view) override; | |
| 49 RenderWidgetHost* GetRenderWidgetHost() const override; | |
| 50 void SetSize(const gfx::Size& size) override; | |
| 51 void SetBounds(const gfx::Rect& rect) override; | |
| 52 void Focus() override; | |
| 53 bool HasFocus() const override; | |
| 54 bool IsSurfaceAvailableForCopy() const override; | |
| 55 void Show() override; | |
| 56 void Hide() override; | |
| 57 bool IsShowing() override; | |
| 58 gfx::NativeView GetNativeView() const override; | |
| 59 gfx::NativeViewAccessible GetNativeViewAccessible() override; | |
| 60 gfx::Rect GetViewBounds() const override; | |
| 61 gfx::Vector2dF GetLastScrollOffset() const override; | |
| 62 void SetBackgroundColor(SkColor color) override; | |
| 63 gfx::Size GetPhysicalBackingSize() const override; | |
| 64 base::string16 GetSelectedText() override; | |
| 65 | |
| 66 // RenderWidgetHostViewBase implementation. | |
| 67 void InitAsPopup(RenderWidgetHostView* parent_host_view, | |
| 68 const gfx::Rect& bounds) override; | |
| 69 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | |
| 70 void UpdateCursor(const WebCursor& cursor) override; | |
| 71 void SetIsLoading(bool is_loading) override; | |
| 72 void TextInputStateChanged(const TextInputState& params) override; | |
| 73 void ImeCancelComposition() override; | |
| 74 #if defined(OS_MACOSX) || defined(USE_AURA) | |
| 75 void ImeCompositionRangeChanged( | |
| 76 const gfx::Range& range, | |
| 77 const std::vector<gfx::Rect>& character_bounds) override; | |
| 78 #endif | |
| 79 void RenderProcessGone(base::TerminationStatus status, | |
| 80 int error_code) override; | |
| 81 void Destroy() override; | |
| 82 void SetTooltipText(const base::string16& tooltip_text) override; | |
| 83 void SelectionChanged(const base::string16& text, | |
| 84 size_t offset, | |
| 85 const gfx::Range& range) override; | |
| 86 void SelectionBoundsChanged( | |
| 87 const ViewHostMsg_SelectionBounds_Params& params) override; | |
| 88 void CopyFromCompositingSurface( | |
| 89 const gfx::Rect& src_subrect, | |
| 90 const gfx::Size& dst_size, | |
| 91 const ReadbackRequestCallback& callback, | |
| 92 const SkColorType preferred_color_type) override; | |
| 93 void CopyFromCompositingSurfaceToVideoFrame( | |
| 94 const gfx::Rect& src_subrect, | |
| 95 const scoped_refptr<media::VideoFrame>& target, | |
| 96 const base::Callback<void(const gfx::Rect&, bool)>& callback) override; | |
| 97 bool CanCopyToVideoFrame() const override; | |
| 98 bool HasAcceleratedSurface(const gfx::Size& desired_size) override; | |
| 99 void ClearCompositorFrame() override {} | |
| 100 bool LockMouse() override; | |
| 101 void UnlockMouse() override; | |
| 102 gfx::Rect GetBoundsInRootWindow() override; | |
| 103 void SetNeedsBeginFrames(bool needs_begin_frames) override; | |
| 104 | |
| 105 #if defined(OS_MACOSX) | |
| 106 // RenderWidgetHostView implementation. | |
| 107 ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override; | |
| 108 void SetActive(bool active) override; | |
| 109 void ShowDefinitionForSelection() override; | |
| 110 bool SupportsSpeech() const override; | |
| 111 void SpeakSelection() override; | |
| 112 bool IsSpeaking() const override; | |
| 113 void StopSpeaking() override; | |
| 114 #endif // defined(OS_MACOSX) | |
| 115 | |
| 116 void LockCompositingSurface() override; | |
| 117 void UnlockCompositingSurface() override; | |
| 118 | |
| 119 // ui::InputEventHandler: | |
| 120 void OnWindowInputEvent( | |
| 121 ui::Window* target, | |
| 122 const ui::Event& event, | |
| 123 std::unique_ptr<base::Callback<void(ui::mojom::EventResult)>>* | |
| 124 ack_callback) override; | |
| 125 | |
| 126 RenderWidgetHostImpl* host_; | |
| 127 | |
| 128 aura::Window* aura_window_; | |
| 129 | |
| 130 std::unique_ptr<ui::ScopedWindowPtr> mus_window_; | |
| 131 | |
| 132 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMus); | |
| 133 }; | |
| 134 | |
| 135 } // namespace content | |
| 136 | |
| 137 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MUS_H_ | |
| OLD | NEW |