Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/shell/renderer/test_runner/mock_presentation_client.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 MockPresentationClient::MockPresentationClient() | |
| 13 : controller_(nullptr), | |
| 14 screen_availability_(false) { | |
| 15 } | |
| 16 | |
| 17 MockPresentationClient::~MockPresentationClient() { | |
| 18 } | |
| 19 | |
| 20 void MockPresentationClient::SetScreenAvailability(bool available) { | |
| 21 if (screen_availability_ == available) | |
| 22 return; | |
| 23 screen_availability_ = available; | |
| 24 | |
| 25 if (!controller_) | |
| 26 return; | |
| 27 if (!controller_->isAvailableChangeWatched()) | |
| 28 return; | |
| 29 controller_->didChangeAvailability(screen_availability_); | |
| 30 } | |
| 31 | |
| 32 void MockPresentationClient::setController( | |
| 33 blink::WebPresentationController* controller) { | |
| 34 controller_ = controller; | |
|
Peter Beverloo
2015/02/09 17:40:32
I don't like removing the DCHECK() here because yo
whywhat
2015/02/12 16:30:47
Acknowledged.
| |
| 35 if (controller_) | |
| 36 updateAvailableChangeWatched(controller_->isAvailableChangeWatched()); | |
| 37 } | |
| 38 | |
| 39 void MockPresentationClient::updateAvailableChangeWatched(bool watched) { | |
| 40 if (!watched) | |
| 41 return; | |
| 42 DCHECK(controller_); | |
| 43 if (screen_availability_) | |
| 44 controller_->didChangeAvailability(screen_availability_); | |
| 45 } | |
| 46 | |
| 47 } // namespace content | |
| OLD | NEW |