| 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" |
| 11 #include "base/location.h" | |
| 12 #include "base/single_thread_task_runner.h" | |
| 13 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/thread_task_runner_handle.h" | |
| 16 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
| 17 #include "content/browser/devtools/protocol/color_picker.h" | 14 #include "content/browser/devtools/protocol/color_picker.h" |
| 18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 15 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 20 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
| 21 #include "content/common/view_messages.h" | 18 #include "content/common/view_messages.h" |
| 22 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/javascript_dialog_manager.h" | 20 #include "content/public/browser/javascript_dialog_manager.h" |
| 24 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
| 25 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 419 } |
| 423 | 420 |
| 424 void PageHandler::ScreencastFrameCaptured( | 421 void PageHandler::ScreencastFrameCaptured( |
| 425 const cc::CompositorFrameMetadata& metadata, | 422 const cc::CompositorFrameMetadata& metadata, |
| 426 const SkBitmap& bitmap, | 423 const SkBitmap& bitmap, |
| 427 ReadbackResponse response) { | 424 ReadbackResponse response) { |
| 428 if (response != READBACK_SUCCESS) { | 425 if (response != READBACK_SUCCESS) { |
| 429 processing_screencast_frame_ = false; | 426 processing_screencast_frame_ = false; |
| 430 if (capture_retry_count_) { | 427 if (capture_retry_count_) { |
| 431 --capture_retry_count_; | 428 --capture_retry_count_; |
| 432 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 429 base::MessageLoop::current()->PostDelayedTask( |
| 433 FROM_HERE, base::Bind(&PageHandler::InnerSwapCompositorFrame, | 430 FROM_HERE, |
| 434 weak_factory_.GetWeakPtr()), | 431 base::Bind(&PageHandler::InnerSwapCompositorFrame, |
| 432 weak_factory_.GetWeakPtr()), |
| 435 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs)); | 433 base::TimeDelta::FromMilliseconds(kFrameRetryDelayMs)); |
| 436 } | 434 } |
| 437 return; | 435 return; |
| 438 } | 436 } |
| 439 base::PostTaskAndReplyWithResult( | 437 base::PostTaskAndReplyWithResult( |
| 440 base::WorkerPool::GetTaskRunner(true).get(), | 438 base::WorkerPool::GetTaskRunner(true).get(), |
| 441 FROM_HERE, | 439 FROM_HERE, |
| 442 base::Bind(&EncodeScreencastFrame, | 440 base::Bind(&EncodeScreencastFrame, |
| 443 bitmap, screencast_format_, screencast_quality_), | 441 bitmap, screencast_format_, screencast_quality_), |
| 444 base::Bind(&PageHandler::ScreencastFrameEncoded, | 442 base::Bind(&PageHandler::ScreencastFrameEncoded, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 495 |
| 498 void PageHandler::OnColorPicked(int r, int g, int b, int a) { | 496 void PageHandler::OnColorPicked(int r, int g, int b, int a) { |
| 499 scoped_refptr<dom::RGBA> color = | 497 scoped_refptr<dom::RGBA> color = |
| 500 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); | 498 dom::RGBA::Create()->set_r(r)->set_g(g)->set_b(b)->set_a(a); |
| 501 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); | 499 client_->ColorPicked(ColorPickedParams::Create()->set_color(color)); |
| 502 } | 500 } |
| 503 | 501 |
| 504 } // namespace page | 502 } // namespace page |
| 505 } // namespace devtools | 503 } // namespace devtools |
| 506 } // namespace content | 504 } // namespace content |
| OLD | NEW |