Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {} | 262 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override {} |
| 263 | 263 |
| 264 void OnSurfaceDamaged(const cc::SurfaceId& id, bool* changed) override { | 264 void OnSurfaceDamaged(const cc::SurfaceId& id, bool* changed) override { |
| 265 *changed = true; | 265 *changed = true; |
| 266 } | 266 } |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { | 269 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { |
| 270 public: | 270 public: |
| 271 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback) | 271 FakeFrameSubscriber(gfx::Size size, base::Callback<void(bool)> callback) |
| 272 : size_(size), callback_(callback), should_capture_(true) {} | 272 : size_(size), |
| 273 callback_(callback), | |
| 274 should_capture_(true), | |
| 275 source_id_for_copy_request_(base::UnguessableToken::Create()) {} | |
| 273 | 276 |
| 274 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, | 277 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, |
| 275 base::TimeTicks present_time, | 278 base::TimeTicks present_time, |
| 276 scoped_refptr<media::VideoFrame>* storage, | 279 scoped_refptr<media::VideoFrame>* storage, |
| 277 DeliverFrameCallback* callback) override { | 280 DeliverFrameCallback* callback) override { |
| 278 if (!should_capture_) | 281 if (!should_capture_) |
| 279 return false; | 282 return false; |
| 280 last_present_time_ = present_time; | 283 last_present_time_ = present_time; |
| 281 *storage = media::VideoFrame::CreateFrame(media::PIXEL_FORMAT_YV12, size_, | 284 *storage = media::VideoFrame::CreateFrame(media::PIXEL_FORMAT_YV12, size_, |
| 282 gfx::Rect(size_), size_, | 285 gfx::Rect(size_), size_, |
| 283 base::TimeDelta()); | 286 base::TimeDelta()); |
| 284 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_); | 287 *callback = base::Bind(&FakeFrameSubscriber::CallbackMethod, callback_); |
| 285 return true; | 288 return true; |
| 286 } | 289 } |
| 287 | 290 |
| 291 base::UnguessableToken GetSourceIdForCopyRequest() override { | |
|
Fady Samuel
2017/01/26 21:22:42
const base::UnguessableToken&
Saman Sami
2017/01/26 21:47:27
Done.
| |
| 292 return source_id_for_copy_request_; | |
| 293 } | |
| 294 | |
| 288 base::TimeTicks last_present_time() const { return last_present_time_; } | 295 base::TimeTicks last_present_time() const { return last_present_time_; } |
| 289 | 296 |
| 290 void set_should_capture(bool should_capture) { | 297 void set_should_capture(bool should_capture) { |
| 291 should_capture_ = should_capture; | 298 should_capture_ = should_capture; |
| 292 } | 299 } |
| 293 | 300 |
| 294 static void CallbackMethod(base::Callback<void(bool)> callback, | 301 static void CallbackMethod(base::Callback<void(bool)> callback, |
| 295 base::TimeTicks present_time, | 302 base::TimeTicks present_time, |
| 296 const gfx::Rect& region_in_frame, | 303 const gfx::Rect& region_in_frame, |
| 297 bool success) { | 304 bool success) { |
| 298 callback.Run(success); | 305 callback.Run(success); |
| 299 } | 306 } |
| 300 | 307 |
| 301 private: | 308 private: |
| 302 gfx::Size size_; | 309 gfx::Size size_; |
| 303 base::Callback<void(bool)> callback_; | 310 base::Callback<void(bool)> callback_; |
| 304 base::TimeTicks last_present_time_; | 311 base::TimeTicks last_present_time_; |
| 305 bool should_capture_; | 312 bool should_capture_; |
| 313 base::UnguessableToken source_id_for_copy_request_; | |
| 306 }; | 314 }; |
| 307 | 315 |
| 308 class FakeWindowEventDispatcher : public aura::WindowEventDispatcher { | 316 class FakeWindowEventDispatcher : public aura::WindowEventDispatcher { |
| 309 public: | 317 public: |
| 310 FakeWindowEventDispatcher(aura::WindowTreeHost* host) | 318 FakeWindowEventDispatcher(aura::WindowTreeHost* host) |
| 311 : WindowEventDispatcher(host), | 319 : WindowEventDispatcher(host), |
| 312 processed_touch_event_count_(0) {} | 320 processed_touch_event_count_(0) {} |
| 313 | 321 |
| 314 void ProcessedTouchEvent(uint32_t unique_event_id, | 322 void ProcessedTouchEvent(uint32_t unique_event_id, |
| 315 aura::Window* window, | 323 aura::Window* window, |
| (...skipping 4443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4759 // There is no composition in the beginning. | 4767 // There is no composition in the beginning. |
| 4760 EXPECT_FALSE(has_composition_text()); | 4768 EXPECT_FALSE(has_composition_text()); |
| 4761 SetHasCompositionTextToTrue(); | 4769 SetHasCompositionTextToTrue(); |
| 4762 view->ImeCancelComposition(); | 4770 view->ImeCancelComposition(); |
| 4763 // The composition must have been canceled. | 4771 // The composition must have been canceled. |
| 4764 EXPECT_FALSE(has_composition_text()); | 4772 EXPECT_FALSE(has_composition_text()); |
| 4765 } | 4773 } |
| 4766 } | 4774 } |
| 4767 | 4775 |
| 4768 } // namespace content | 4776 } // namespace content |
| OLD | NEW |