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

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

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Encode in ui snapshot methods instead. Created 3 years, 11 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_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 30 matching lines...) Expand all
41 #include "content/public/browser/render_widget_host.h" 41 #include "content/public/browser/render_widget_host.h"
42 #include "content/public/common/page_zoom.h" 42 #include "content/public/common/page_zoom.h"
43 #include "content/public/common/url_constants.h" 43 #include "content/public/common/url_constants.h"
44 #include "ipc/ipc_listener.h" 44 #include "ipc/ipc_listener.h"
45 #include "third_party/WebKit/public/platform/WebDisplayMode.h" 45 #include "third_party/WebKit/public/platform/WebDisplayMode.h"
46 #include "ui/base/ime/text_input_mode.h" 46 #include "ui/base/ime/text_input_mode.h"
47 #include "ui/base/ime/text_input_type.h" 47 #include "ui/base/ime/text_input_type.h"
48 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 48 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
49 #include "ui/events/latency_info.h" 49 #include "ui/events/latency_info.h"
50 #include "ui/gfx/native_widget_types.h" 50 #include "ui/gfx/native_widget_types.h"
51 #include "ui/snapshot/snapshot.h"
51 52
52 struct FrameHostMsg_HittestData_Params; 53 struct FrameHostMsg_HittestData_Params;
53 struct ViewHostMsg_SelectionBounds_Params; 54 struct ViewHostMsg_SelectionBounds_Params;
54 struct ViewHostMsg_UpdateRect_Params; 55 struct ViewHostMsg_UpdateRect_Params;
55 56
56 namespace base { 57 namespace base {
57 class RefCountedBytes; 58 class RefCountedBytes;
58 } 59 }
59 60
60 namespace blink { 61 namespace blink {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void DragSourceEndedAt(const gfx::Point& client_pt, 203 void DragSourceEndedAt(const gfx::Point& client_pt,
203 const gfx::Point& screen_pt, 204 const gfx::Point& screen_pt,
204 blink::WebDragOperation operation) override; 205 blink::WebDragOperation operation) override;
205 void DragSourceSystemDragEnded() override; 206 void DragSourceSystemDragEnded() override;
206 void FilterDropData(DropData* drop_data) override; 207 void FilterDropData(DropData* drop_data) override;
207 208
208 // Notification that the screen info has changed. 209 // Notification that the screen info has changed.
209 void NotifyScreenInfoChanged(); 210 void NotifyScreenInfoChanged();
210 211
211 // Forces redraw in the renderer and when the update reaches the browser 212 // Forces redraw in the renderer and when the update reaches the browser
212 // grabs snapshot from the compositor. Returns PNG-encoded snapshot. 213 // grabs snapshot from the compositor. Returns encoded snapshot.
213 using GetSnapshotFromBrowserCallback = 214 using GetSnapshotFromBrowserCallback =
214 base::Callback<void(const unsigned char*, size_t)>; 215 base::Callback<void(const unsigned char*, size_t)>;
215 void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback); 216 void GetSnapshotFromBrowser(const GetSnapshotFromBrowserCallback& callback,
217 ui::SnapshotEncoding encoding,
218 ui::SnapshotQuality quality);
216 219
217 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const; 220 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const;
218 221
219 // Sets the View of this RenderWidgetHost. 222 // Sets the View of this RenderWidgetHost.
220 void SetView(RenderWidgetHostViewBase* view); 223 void SetView(RenderWidgetHostViewBase* view);
221 224
222 RenderWidgetHostDelegate* delegate() const { return delegate_; } 225 RenderWidgetHostDelegate* delegate() const { return delegate_; }
223 226
224 bool empty() const { return current_size_.IsEmpty(); } 227 bool empty() const { return current_size_.IsEmpty(); }
225 228
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 void OnUnexpectedEventAck(UnexpectedEventAckType type) override; 696 void OnUnexpectedEventAck(UnexpectedEventAckType type) override;
694 697
695 void OnSyntheticGestureCompleted(SyntheticGesture::Result result); 698 void OnSyntheticGestureCompleted(SyntheticGesture::Result result);
696 699
697 // Called when there is a new auto resize (using a post to avoid a stack 700 // Called when there is a new auto resize (using a post to avoid a stack
698 // which may get in recursive loops). 701 // which may get in recursive loops).
699 void DelayedAutoResized(); 702 void DelayedAutoResized();
700 703
701 void WindowSnapshotReachedScreen(int snapshot_id); 704 void WindowSnapshotReachedScreen(int snapshot_id);
702 705
703 void OnSnapshotDataReceived(int snapshot_id, 706 void OnSnapshotDataReceived(const GetSnapshotFromBrowserCallback& callback,
704 const unsigned char* png, 707 const unsigned char* data,
705 size_t size); 708 size_t size);
706 709
707 void OnSnapshotDataReceivedAsync( 710 void OnSnapshotDataReceivedAsync(
708 int snapshot_id, 711 const GetSnapshotFromBrowserCallback& callback,
709 scoped_refptr<base::RefCountedBytes> png_data); 712 scoped_refptr<base::RefCountedBytes> data);
710 713
711 // 1. Grants permissions to URL (if any) 714 // 1. Grants permissions to URL (if any)
712 // 2. Grants permissions to filenames 715 // 2. Grants permissions to filenames
713 // 3. Grants permissions to file system files. 716 // 3. Grants permissions to file system files.
714 // 4. Register the files with the IsolatedContext. 717 // 4. Register the files with the IsolatedContext.
715 void GrantFileAccessFromDropData(DropData* drop_data); 718 void GrantFileAccessFromDropData(DropData* drop_data);
716 719
717 // true if a renderer has once been valid. We use this flag to display a sad 720 // true if a renderer has once been valid. We use this flag to display a sad
718 // tab only when we lose our renderer and not if a paint occurs during 721 // tab only when we lose our renderer and not if a paint occurs during
719 // initialization. 722 // initialization.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 // |new_content_rendering_timeout_| is not needed. The renderer will send 862 // |new_content_rendering_timeout_| is not needed. The renderer will send
860 // both the FirstPaintAfterLoad and DidCommitProvisionalLoad messages after 863 // both the FirstPaintAfterLoad and DidCommitProvisionalLoad messages after
861 // any new page navigation, it doesn't matter which is received first, and 864 // any new page navigation, it doesn't matter which is received first, and
862 // it should not be possible to interleave other navigations in between 865 // it should not be possible to interleave other navigations in between
863 // receipt of those messages (unless FirstPaintAfterLoad is prevented from 866 // receipt of those messages (unless FirstPaintAfterLoad is prevented from
864 // being sent, in which case the timer should fire). 867 // being sent, in which case the timer should fire).
865 bool received_paint_after_load_; 868 bool received_paint_after_load_;
866 869
867 RenderWidgetHostLatencyTracker latency_tracker_; 870 RenderWidgetHostLatencyTracker latency_tracker_;
868 871
872 struct PendingSnapshotParams {
873 PendingSnapshotParams(const GetSnapshotFromBrowserCallback& callback,
874 ui::SnapshotEncoding encoding,
875 ui::SnapshotQuality quality);
876 PendingSnapshotParams(const PendingSnapshotParams& params);
877 ~PendingSnapshotParams();
878
879 GetSnapshotFromBrowserCallback callback;
880 ui::SnapshotEncoding encoding;
881 ui::SnapshotQuality quality;
882 };
883 using PendingSnapshotParamsMap = std::map<int, PendingSnapshotParams>;
884
869 int next_browser_snapshot_id_; 885 int next_browser_snapshot_id_;
870 using PendingSnapshotMap = std::map<int, GetSnapshotFromBrowserCallback>; 886 PendingSnapshotParamsMap pending_browser_snapshot_params_;
871 PendingSnapshotMap pending_browser_snapshots_; 887 int pending_browser_snapshots_;
pfeldman 2017/01/03 18:42:33 not sure why you need it now.
Eric Seckler 2017/01/03 19:18:09 Currently, OnSnapshotDataReceived can't remove fro
872 888
873 // Indicates whether a RenderFramehost has ownership, in which case this 889 // Indicates whether a RenderFramehost has ownership, in which case this
874 // object does not self destroy. 890 // object does not self destroy.
875 bool owned_by_render_frame_host_; 891 bool owned_by_render_frame_host_;
876 892
877 // Indicates whether this RenderWidgetHost thinks is focused. This is trying 893 // Indicates whether this RenderWidgetHost thinks is focused. This is trying
878 // to match what the renderer process knows. It is different from 894 // to match what the renderer process knows. It is different from
879 // RenderWidgetHostView::HasFocus in that in that the focus request may fail, 895 // RenderWidgetHostView::HasFocus in that in that the focus request may fail,
880 // causing HasFocus to return false when is_focused_ is true. 896 // causing HasFocus to return false when is_focused_ is true.
881 bool is_focused_; 897 bool is_focused_;
(...skipping 25 matching lines...) Expand all
907 #endif 923 #endif
908 924
909 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; 925 base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_;
910 926
911 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); 927 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl);
912 }; 928 };
913 929
914 } // namespace content 930 } // namespace content
915 931
916 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_ 932 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698