Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.h

Issue 2702093002: Consistent CopyFromSurface() API, consolidated to RWHV (Closed)
Patch Set: REBASE Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/process/kill.h" 18 #include "base/process/kill.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "cc/output/compositor_frame.h" 22 #include "cc/output/compositor_frame.h"
23 #include "cc/surfaces/surface_id.h" 23 #include "cc/surfaces/surface_id.h"
24 #include "content/browser/renderer_host/event_with_latency_info.h" 24 #include "content/browser/renderer_host/event_with_latency_info.h"
25 #include "content/common/content_export.h" 25 #include "content/common/content_export.h"
26 #include "content/common/input/input_event_ack_state.h" 26 #include "content/common/input/input_event_ack_state.h"
27 #include "content/public/browser/readback_types.h"
28 #include "content/public/browser/render_widget_host_view.h" 27 #include "content/public/browser/render_widget_host_view.h"
29 #include "content/public/common/screen_info.h" 28 #include "content/public/common/screen_info.h"
30 #include "ipc/ipc_listener.h" 29 #include "ipc/ipc_listener.h"
31 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationType.h" 30 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScree nOrientationType.h"
32 #include "third_party/WebKit/public/web/WebPopupType.h" 31 #include "third_party/WebKit/public/web/WebPopupType.h"
33 #include "third_party/WebKit/public/web/WebTextDirection.h" 32 #include "third_party/WebKit/public/web/WebTextDirection.h"
34 #include "third_party/skia/include/core/SkImageInfo.h" 33 #include "third_party/skia/include/core/SkImageInfo.h"
35 #include "ui/base/ime/text_input_mode.h" 34 #include "ui/base/ime/text_input_mode.h"
36 #include "ui/base/ime/text_input_type.h" 35 #include "ui/base/ime/text_input_type.h"
37 #include "ui/display/display.h" 36 #include "ui/display/display.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ui::TextInputClient* GetTextInputClient() override; 94 ui::TextInputClient* GetTextInputClient() override;
96 void WasUnOccluded() override {} 95 void WasUnOccluded() override {}
97 void WasOccluded() override {} 96 void WasOccluded() override {}
98 bool IsShowingContextMenu() const override; 97 bool IsShowingContextMenu() const override;
99 void SetShowingContextMenu(bool showing_menu) override; 98 void SetShowingContextMenu(bool showing_menu) override;
100 void SetIsInVR(bool is_in_vr) override; 99 void SetIsInVR(bool is_in_vr) override;
101 base::string16 GetSelectedText() override; 100 base::string16 GetSelectedText() override;
102 bool IsMouseLocked() override; 101 bool IsMouseLocked() override;
103 gfx::Size GetVisibleViewportSize() const override; 102 gfx::Size GetVisibleViewportSize() const override;
104 void SetInsets(const gfx::Insets& insets) override; 103 void SetInsets(const gfx::Insets& insets) override;
104 bool IsSurfaceAvailableForCopy() const override;
105 void CopyFromSurface(const gfx::Rect& src_rect,
106 const gfx::Size& output_size,
107 const ReadbackRequestCallback& callback,
108 const SkColorType color_type) override;
109 void CopyFromSurfaceToVideoFrame(
110 const gfx::Rect& src_rect,
111 scoped_refptr<media::VideoFrame> target,
112 const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
105 void BeginFrameSubscription( 113 void BeginFrameSubscription(
106 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; 114 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
107 void EndFrameSubscription() override; 115 void EndFrameSubscription() override;
108 void FocusedNodeTouched(const gfx::Point& location_dips_screen, 116 void FocusedNodeTouched(const gfx::Point& location_dips_screen,
109 bool editable) override; 117 bool editable) override;
110 118
111 // This only needs to be overridden by RenderWidgetHostViewBase subclasses 119 // This only needs to be overridden by RenderWidgetHostViewBase subclasses
112 // that handle content embedded within other RenderWidgetHostViews. 120 // that handle content embedded within other RenderWidgetHostViews.
113 gfx::Point TransformPointToRootCoordSpace(const gfx::Point& point) override; 121 gfx::Point TransformPointToRootCoordSpace(const gfx::Point& point) override;
114 gfx::PointF TransformPointToRootCoordSpaceF( 122 gfx::PointF TransformPointToRootCoordSpaceF(
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 virtual void RenderProcessGone(base::TerminationStatus status, 348 virtual void RenderProcessGone(base::TerminationStatus status,
341 int error_code) = 0; 349 int error_code) = 0;
342 350
343 // Tells the View to destroy itself. 351 // Tells the View to destroy itself.
344 virtual void Destroy() = 0; 352 virtual void Destroy() = 0;
345 353
346 // Tells the View that the tooltip text for the current mouse position over 354 // Tells the View that the tooltip text for the current mouse position over
347 // the page has changed. 355 // the page has changed.
348 virtual void SetTooltipText(const base::string16& tooltip_text) = 0; 356 virtual void SetTooltipText(const base::string16& tooltip_text) = 0;
349 357
350 // Copies the contents of the compositing surface, providing a new SkBitmap
351 // result via an asynchronously-run |callback|. |src_subrect| is specified in
352 // layer space coordinates for the current platform (e.g., DIP for Aura/Mac,
353 // physical for Android), and is the region to be copied from this view. When
354 // |src_subrect| is empty then the whole surface will be copied. The copy is
355 // then scaled to a SkBitmap of size |dst_size|. If |dst_size| is empty then
356 // output will be unscaled. |callback| is run with true on success,
357 // false otherwise. A smaller region than |src_subrect| may be copied
358 // if the underlying surface is smaller than |src_subrect|.
359 virtual void CopyFromCompositingSurface(
360 const gfx::Rect& src_subrect,
361 const gfx::Size& dst_size,
362 const ReadbackRequestCallback& callback,
363 const SkColorType preferred_color_type) = 0;
364
365 // Copies the contents of the compositing surface, populating the given
366 // |target| with YV12 image data. |src_subrect| is specified in layer space
367 // coordinates for the current platform (e.g., DIP for Aura/Mac, physical for
368 // Android), and is the region to be copied from this view. The copy is then
369 // scaled and letterboxed with black borders to fit |target|. Finally,
370 // |callback| is asynchronously run with true/false for
371 // success/failure. |target| must point to an allocated, YV12 video frame of
372 // the intended size. This operation will fail if there is no available
373 // compositing surface.
374 virtual void CopyFromCompositingSurfaceToVideoFrame(
375 const gfx::Rect& src_subrect,
376 const scoped_refptr<media::VideoFrame>& target,
377 const base::Callback<void(const gfx::Rect&, bool)>& callback) = 0;
378
379 // Returns true if CopyFromCompositingSurfaceToVideoFrame() is likely to
380 // succeed.
381 //
382 // TODO(nick): When VideoFrame copies are broadly implemented, this method
383 // should be renamed to HasCompositingSurface(), or unified with
384 // IsSurfaceAvailableForCopy() and HasAcceleratedSurface().
385 virtual bool CanCopyToVideoFrame() const = 0;
386
387 // Return true if the view has an accelerated surface that contains the last 358 // Return true if the view has an accelerated surface that contains the last
388 // presented frame for the view. If |desired_size| is non-empty, true is 359 // presented frame for the view. If |desired_size| is non-empty, true is
389 // returned only if the accelerated surface size matches. 360 // returned only if the accelerated surface size matches.
390 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) = 0; 361 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) = 0;
391 362
392 // Compute the orientation type of the display assuming it is a mobile device. 363 // Compute the orientation type of the display assuming it is a mobile device.
393 static ScreenOrientationValues GetOrientationTypeForMobile( 364 static ScreenOrientationValues GetOrientationTypeForMobile(
394 const display::Display& display); 365 const display::Display& display);
395 366
396 // Compute the orientation type of the display assuming it is a desktop. 367 // Compute the orientation type of the display assuming it is a desktop.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; 454 base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
484 455
485 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; 456 base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
486 457
487 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); 458 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
488 }; 459 };
489 460
490 } // namespace content 461 } // namespace content
491 462
492 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ 463 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698