| 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_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/readback_types.h" |
| 13 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 14 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "third_party/skia/include/core/SkImageInfo.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 16 | 18 |
| 17 namespace gfx { | 19 namespace gfx { |
| 18 class Point; | 20 class Point; |
| 19 class Rect; | 21 class Rect; |
| 20 class Size; | 22 class Size; |
| 21 } | 23 } |
| 22 | 24 |
| 25 namespace media { |
| 26 class VideoFrame; |
| 27 } |
| 28 |
| 23 namespace ui { | 29 namespace ui { |
| 24 class TextInputClient; | 30 class TextInputClient; |
| 25 class AcceleratedWidgetMac; | 31 class AcceleratedWidgetMac; |
| 26 } | 32 } |
| 27 | 33 |
| 28 namespace content { | 34 namespace content { |
| 29 | 35 |
| 30 class RenderWidgetHost; | 36 class RenderWidgetHost; |
| 31 class RenderWidgetHostViewFrameSubscriber; | 37 class RenderWidgetHostViewFrameSubscriber; |
| 32 | 38 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // doesn't support text input. | 95 // doesn't support text input. |
| 90 // Note: Not all the platforms use ui::InputMethod and ui::TextInputClient for | 96 // Note: Not all the platforms use ui::InputMethod and ui::TextInputClient for |
| 91 // text input. Some platforms (Mac and Android for example) use their own | 97 // text input. Some platforms (Mac and Android for example) use their own |
| 92 // text input system. | 98 // text input system. |
| 93 virtual ui::TextInputClient* GetTextInputClient() = 0; | 99 virtual ui::TextInputClient* GetTextInputClient() = 0; |
| 94 | 100 |
| 95 // Set focus to the associated View component. | 101 // Set focus to the associated View component. |
| 96 virtual void Focus() = 0; | 102 virtual void Focus() = 0; |
| 97 // Returns true if the View currently has the focus. | 103 // Returns true if the View currently has the focus. |
| 98 virtual bool HasFocus() const = 0; | 104 virtual bool HasFocus() const = 0; |
| 99 // Returns true is the current display surface is available. | |
| 100 virtual bool IsSurfaceAvailableForCopy() const = 0; | |
| 101 | 105 |
| 102 // Shows/hides the view. These must always be called together in pairs. | 106 // Shows/hides the view. These must always be called together in pairs. |
| 103 // It is not legal to call Hide() multiple times in a row. | 107 // It is not legal to call Hide() multiple times in a row. |
| 104 virtual void Show() = 0; | 108 virtual void Show() = 0; |
| 105 virtual void Hide() = 0; | 109 virtual void Hide() = 0; |
| 106 | 110 |
| 107 // Whether the view is showing. | 111 // Whether the view is showing. |
| 108 virtual bool IsShowing() = 0; | 112 virtual bool IsShowing() = 0; |
| 109 | 113 |
| 110 // Indicates if the view is currently occluded (e.g, not visible because it's | 114 // Indicates if the view is currently occluded (e.g, not visible because it's |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 148 |
| 145 // Retrives the size of the viewport for the visible region. May be smaller | 149 // Retrives the size of the viewport for the visible region. May be smaller |
| 146 // than the view size if a portion of the view is obstructed (e.g. by a | 150 // than the view size if a portion of the view is obstructed (e.g. by a |
| 147 // virtual keyboard). | 151 // virtual keyboard). |
| 148 virtual gfx::Size GetVisibleViewportSize() const = 0; | 152 virtual gfx::Size GetVisibleViewportSize() const = 0; |
| 149 | 153 |
| 150 // Set insets for the visible region of the root window. Used to compute the | 154 // Set insets for the visible region of the root window. Used to compute the |
| 151 // visible viewport. | 155 // visible viewport. |
| 152 virtual void SetInsets(const gfx::Insets& insets) = 0; | 156 virtual void SetInsets(const gfx::Insets& insets) = 0; |
| 153 | 157 |
| 158 // Returns true if the current display surface is available, a prerequisite |
| 159 // for CopyFromSurface() or CopyFromSurfaceToVideoFrame() to succeed. |
| 160 virtual bool IsSurfaceAvailableForCopy() const = 0; |
| 161 |
| 162 // Copies the given subset of the view's surface, optionally scales it, and |
| 163 // returns the result as a bitmap via the provided callback. This is meant for |
| 164 // one-off snapshots. For continuous video capture of the surface, please use |
| 165 // BeginFrameSubscription(). |
| 166 // |
| 167 // |src_rect| is either the subset of the view's surface, in view coordinates, |
| 168 // or empty to indicate that all of it should be copied. This is NOT the same |
| 169 // coordinate system as that used GetViewBounds() (https://crbug.com/73362). |
| 170 // |
| 171 // |output_size| is the size of the resulting bitmap, or empty to indicate no |
| 172 // scaling is desired. If an empty size is provided, note that the resulting |
| 173 // bitmap's size may not be the same as |src_rect.size()| due to the pixel |
| 174 // scale used by the underlying device. |
| 175 // |
| 176 // |callback| is always invoked, at some point in the future, with success/ |
| 177 // fail status and an SkBitmap containing the copied pixel data. It may be |
| 178 // called sychronously or asynchronously. |
| 179 // |
| 180 // If the view's renderer is suspended (see WasOccluded()), this may result in |
| 181 // copying old data or failing. |
| 182 virtual void CopyFromSurface(const gfx::Rect& src_rect, |
| 183 const gfx::Size& output_size, |
| 184 const ReadbackRequestCallback& callback, |
| 185 const SkColorType color_type) = 0; |
| 186 |
| 187 // Copies the given subset of the view's surface, scales/letterboxes it, and |
| 188 // returns the result within the provided media::VideoFrame. This is meant for |
| 189 // one-off snapshots. For continuous video capture of the surface, please use |
| 190 // BeginFrameSubscription(). |
| 191 // |
| 192 // |src_rect| is either the subset of the view's surface, in view coordinates, |
| 193 // or empty to indicate that all of it should be copied. This is NOT the same |
| 194 // coordinate system as that used GetViewBounds() (https://crbug.com/73362). |
| 195 // |
| 196 // The |target| must use a pixel format supported by the platform. The size of |
| 197 // the source region and the target together will determine how the content is |
| 198 // positioned and scaled within the video frame. The aspect ratio of the |
| 199 // source region will always be preserved, with letterboxing/pillarboxing |
| 200 // applied to fill the entire frame. |
| 201 // |
| 202 // |callback| is always invoked, at some point in the future, with the region |
| 203 // within |target| where the content was placed and a boolean success/fail |
| 204 // flag. It may be called sychronously or asynchronously. |
| 205 // |
| 206 // If the view's renderer is suspended (see WasOccluded()), this may result in |
| 207 // copying old data or failing. |
| 208 virtual void CopyFromSurfaceToVideoFrame( |
| 209 const gfx::Rect& src_rect, |
| 210 scoped_refptr<media::VideoFrame> target, |
| 211 const base::Callback<void(const gfx::Rect&, bool)>& callback) = 0; |
| 212 |
| 154 // Begin subscribing for presentation events and captured frames. | 213 // Begin subscribing for presentation events and captured frames. |
| 155 // |subscriber| is now owned by this object, it will be called only on the | 214 // |subscriber| is now owned by this object, it will be called only on the |
| 156 // UI thread. | 215 // UI thread. |
| 157 virtual void BeginFrameSubscription( | 216 virtual void BeginFrameSubscription( |
| 158 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) = 0; | 217 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) = 0; |
| 159 | 218 |
| 160 // End subscribing for frame presentation events. FrameSubscriber will be | 219 // End subscribing for frame presentation events. FrameSubscriber will be |
| 161 // deleted after this call. | 220 // deleted after this call. |
| 162 virtual void EndFrameSubscription() = 0; | 221 virtual void EndFrameSubscription() = 0; |
| 163 | 222 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 192 // Returns |true| if text is currently being spoken by Mac OS X. | 251 // Returns |true| if text is currently being spoken by Mac OS X. |
| 193 virtual bool IsSpeaking() const = 0; | 252 virtual bool IsSpeaking() const = 0; |
| 194 // Stops speaking, if it is currently in progress. | 253 // Stops speaking, if it is currently in progress. |
| 195 virtual void StopSpeaking() = 0; | 254 virtual void StopSpeaking() = 0; |
| 196 #endif // defined(OS_MACOSX) | 255 #endif // defined(OS_MACOSX) |
| 197 }; | 256 }; |
| 198 | 257 |
| 199 } // namespace content | 258 } // namespace content |
| 200 | 259 |
| 201 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ | 260 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ |
| OLD | NEW |