| 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 #include "content/browser/devtools/protocol/page_handler.h" | 5 #include "content/browser/devtools/protocol/page_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 static const char kJpeg[] = "jpeg"; | 46 static const char kJpeg[] = "jpeg"; |
| 47 static int kDefaultScreenshotQuality = 80; | 47 static int kDefaultScreenshotQuality = 80; |
| 48 static int kFrameRetryDelayMs = 100; | 48 static int kFrameRetryDelayMs = 100; |
| 49 static int kCaptureRetryLimit = 2; | 49 static int kCaptureRetryLimit = 2; |
| 50 static int kMaxScreencastFramesInFlight = 2; | 50 static int kMaxScreencastFramesInFlight = 2; |
| 51 | 51 |
| 52 ui::GestureProviderConfigType TouchEmulationConfigurationToType( | 52 ui::GestureProviderConfigType TouchEmulationConfigurationToType( |
| 53 const std::string& protocol_value) { | 53 const std::string& protocol_value) { |
| 54 ui::GestureProviderConfigType result = | 54 ui::GestureProviderConfigType result = |
| 55 ui::GestureProviderConfigType::CURRENT_PLATFORM; | 55 ui::GestureProviderConfigType::CURRENT_PLATFORM; |
| 56 if (protocol_value == | 56 if (protocol_value == "mobile") { |
| 57 set_touch_emulation_enabled::kConfigurationMobile) { | |
| 58 result = ui::GestureProviderConfigType::GENERIC_MOBILE; | 57 result = ui::GestureProviderConfigType::GENERIC_MOBILE; |
| 59 } | 58 } |
| 60 if (protocol_value == | 59 if (protocol_value == "desktop") { |
| 61 set_touch_emulation_enabled::kConfigurationDesktop) { | |
| 62 result = ui::GestureProviderConfigType::GENERIC_DESKTOP; | 60 result = ui::GestureProviderConfigType::GENERIC_DESKTOP; |
| 63 } | 61 } |
| 64 return result; | 62 return result; |
| 65 } | 63 } |
| 66 | 64 |
| 67 std::string EncodeScreencastFrame(const SkBitmap& bitmap, | 65 std::string EncodeScreencastFrame(const SkBitmap& bitmap, |
| 68 const std::string& format, | 66 const std::string& format, |
| 69 int quality) { | 67 int quality) { |
| 70 std::vector<unsigned char> data; | 68 std::vector<unsigned char> data; |
| 71 SkAutoLockPixels lock_image(bitmap); | 69 SkAutoLockPixels lock_image(bitmap); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 | 677 |
| 680 void PageHandler::OnFramesRecorded( | 678 void PageHandler::OnFramesRecorded( |
| 681 DevToolsCommandId command_id, | 679 DevToolsCommandId command_id, |
| 682 scoped_refptr<StopRecordingFramesResponse> response_data) { | 680 scoped_refptr<StopRecordingFramesResponse> response_data) { |
| 683 client_->SendStopRecordingFramesResponse(command_id, response_data); | 681 client_->SendStopRecordingFramesResponse(command_id, response_data); |
| 684 } | 682 } |
| 685 | 683 |
| 686 } // namespace page | 684 } // namespace page |
| 687 } // namespace devtools | 685 } // namespace devtools |
| 688 } // namespace content | 686 } // namespace content |
| OLD | NEW |