| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "cc/output/compositor_frame_metadata.h" | 12 #include "cc/output/compositor_frame_metadata.h" |
| 13 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | 13 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" |
| 14 #include "content/public/browser/readback_types.h" | 14 #include "content/public/browser/readback_types.h" |
| 15 | 15 |
| 16 class SkBitmap; | 16 class SkBitmap; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class RenderViewHostImpl; | 20 class RenderWidgetHostImpl; |
| 21 class WebContentsImpl; |
| 21 | 22 |
| 22 namespace devtools { | 23 namespace devtools { |
| 23 namespace page { | 24 namespace page { |
| 24 | 25 |
| 25 class ColorPicker; | 26 class ColorPicker; |
| 26 | 27 |
| 27 class PageHandler { | 28 class PageHandler { |
| 28 public: | 29 public: |
| 29 typedef DevToolsProtocolClient::Response Response; | 30 typedef DevToolsProtocolClient::Response Response; |
| 30 | 31 |
| 31 class ScreencastListener { | 32 class ScreencastListener { |
| 32 public: | 33 public: |
| 33 virtual ~ScreencastListener() { } | 34 virtual ~ScreencastListener() { } |
| 34 virtual void ScreencastEnabledChanged() = 0; | 35 virtual void ScreencastEnabledChanged() = 0; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 PageHandler(); | 38 PageHandler(); |
| 38 virtual ~PageHandler(); | 39 virtual ~PageHandler(); |
| 39 | 40 |
| 40 void SetRenderViewHost(RenderViewHostImpl* host); | 41 void SetWebContents(WebContentsImpl* web_contents); |
| 41 void SetClient(scoped_ptr<Client> client); | 42 void SetClient(scoped_ptr<Client> client); |
| 42 void Detached(); | 43 void Detached(); |
| 43 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); | 44 void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata); |
| 44 void OnVisibilityChanged(bool visible); | 45 void OnVisibilityChanged(bool visible); |
| 45 void DidAttachInterstitialPage(); | 46 void DidAttachInterstitialPage(); |
| 46 void DidDetachInterstitialPage(); | 47 void DidDetachInterstitialPage(); |
| 47 void SetScreencastListener(ScreencastListener* listener); | 48 void SetScreencastListener(ScreencastListener* listener); |
| 48 bool screencast_enabled() const { return enabled_ && screencast_enabled_; } | 49 bool screencast_enabled() const { return enabled_ && screencast_enabled_; } |
| 49 | 50 |
| 50 Response Enable(); | 51 Response Enable(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 Response ScreencastFrameAck(int frame_number); | 74 Response ScreencastFrameAck(int frame_number); |
| 74 | 75 |
| 75 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); | 76 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); |
| 76 | 77 |
| 77 Response QueryUsageAndQuota(DevToolsCommandId command_id, | 78 Response QueryUsageAndQuota(DevToolsCommandId command_id, |
| 78 const std::string& security_origin); | 79 const std::string& security_origin); |
| 79 | 80 |
| 80 Response SetColorPickerEnabled(bool enabled); | 81 Response SetColorPickerEnabled(bool enabled); |
| 81 | 82 |
| 82 private: | 83 private: |
| 84 RenderWidgetHostImpl* GetRenderWidgetHost(); |
| 83 void NotifyScreencastVisibility(bool visible); | 85 void NotifyScreencastVisibility(bool visible); |
| 84 void InnerSwapCompositorFrame(); | 86 void InnerSwapCompositorFrame(); |
| 85 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, | 87 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, |
| 86 const SkBitmap& bitmap, | 88 const SkBitmap& bitmap, |
| 87 ReadbackResponse response); | 89 ReadbackResponse response); |
| 88 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, | 90 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, |
| 89 const base::Time& timestamp, | 91 const base::Time& timestamp, |
| 90 const std::string& data); | 92 const std::string& data); |
| 91 | 93 |
| 92 void ScreenshotCaptured( | 94 void ScreenshotCaptured( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 int capture_retry_count_; | 108 int capture_retry_count_; |
| 107 bool has_compositor_frame_metadata_; | 109 bool has_compositor_frame_metadata_; |
| 108 cc::CompositorFrameMetadata next_compositor_frame_metadata_; | 110 cc::CompositorFrameMetadata next_compositor_frame_metadata_; |
| 109 cc::CompositorFrameMetadata last_compositor_frame_metadata_; | 111 cc::CompositorFrameMetadata last_compositor_frame_metadata_; |
| 110 int screencast_frame_sent_; | 112 int screencast_frame_sent_; |
| 111 int screencast_frame_acked_; | 113 int screencast_frame_acked_; |
| 112 bool processing_screencast_frame_; | 114 bool processing_screencast_frame_; |
| 113 | 115 |
| 114 scoped_ptr<ColorPicker> color_picker_; | 116 scoped_ptr<ColorPicker> color_picker_; |
| 115 | 117 |
| 116 RenderViewHostImpl* host_; | 118 WebContentsImpl* web_contents_; |
| 117 scoped_ptr<Client> client_; | 119 scoped_ptr<Client> client_; |
| 118 ScreencastListener* screencast_listener_; | 120 ScreencastListener* screencast_listener_; |
| 119 base::WeakPtrFactory<PageHandler> weak_factory_; | 121 base::WeakPtrFactory<PageHandler> weak_factory_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(PageHandler); | 123 DISALLOW_COPY_AND_ASSIGN(PageHandler); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace page | 126 } // namespace page |
| 125 } // namespace devtools | 127 } // namespace devtools |
| 126 } // namespace content | 128 } // namespace content |
| 127 | 129 |
| 128 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 130 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
| OLD | NEW |