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 DCHECK(controller_ != controller && (!controller || !controller_)); | |
35 controller_ = controller; | |
36 if (controller_) | |
37 updateAvailableChangeWatched(controller_->isAvailableChangeWatched()); | |
38 } | |
39 | |
40 void MockPresentationClient::updateAvailableChangeWatched(bool watched) { | |
41 if (!watched) | |
42 return; | |
43 DCHECK(controller_); | |
44 if (screen_availability_) | |
45 controller_->didChangeAvailability(screen_availability_); | |
46 } | |
47 | |
48 } // namespace content | |
OLD | NEW |