| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "modules/permissions/PermissionController.h" | 5 #include "modules/permissions/PermissionController.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "public/platform/modules/permissions/WebPermissionClient.h" | |
| 10 | 9 |
| 11 namespace blink { | 10 namespace blink { |
| 12 | 11 |
| 13 PermissionController::~PermissionController() {} | 12 PermissionController::~PermissionController() {} |
| 14 | 13 |
| 15 void PermissionController::provideTo(LocalFrame& frame, | 14 void PermissionController::provideTo(LocalFrame& frame) { |
| 16 WebPermissionClient* client) { | |
| 17 ASSERT(RuntimeEnabledFeatures::permissionsEnabled()); | 15 ASSERT(RuntimeEnabledFeatures::permissionsEnabled()); |
| 18 | 16 |
| 19 PermissionController* controller = new PermissionController(frame, client); | 17 PermissionController* controller = new PermissionController(frame); |
| 20 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); | 18 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); |
| 21 } | 19 } |
| 22 | 20 |
| 23 PermissionController* PermissionController::from(LocalFrame& frame) { | 21 PermissionController* PermissionController::from(LocalFrame& frame) { |
| 24 return static_cast<PermissionController*>( | 22 return static_cast<PermissionController*>( |
| 25 Supplement<LocalFrame>::from(frame, supplementName())); | 23 Supplement<LocalFrame>::from(frame, supplementName())); |
| 26 } | 24 } |
| 27 | 25 |
| 28 PermissionController::PermissionController(LocalFrame& frame, | 26 PermissionController::PermissionController(LocalFrame& frame) |
| 29 WebPermissionClient* client) | 27 : DOMWindowProperty(&frame) {} |
| 30 : DOMWindowProperty(&frame), m_client(client) {} | |
| 31 | 28 |
| 32 const char* PermissionController::supplementName() { | 29 const char* PermissionController::supplementName() { |
| 33 return "PermissionController"; | 30 return "PermissionController"; |
| 34 } | 31 } |
| 35 | 32 |
| 36 WebPermissionClient* PermissionController::client() const { | |
| 37 return m_client; | |
| 38 } | |
| 39 | |
| 40 void PermissionController::frameDestroyed() { | 33 void PermissionController::frameDestroyed() { |
| 41 m_client = nullptr; | |
| 42 DOMWindowProperty::frameDestroyed(); | 34 DOMWindowProperty::frameDestroyed(); |
| 43 } | 35 } |
| 44 | 36 |
| 45 DEFINE_TRACE(PermissionController) { | 37 DEFINE_TRACE(PermissionController) { |
| 46 DOMWindowProperty::trace(visitor); | 38 DOMWindowProperty::trace(visitor); |
| 47 Supplement<LocalFrame>::trace(visitor); | 39 Supplement<LocalFrame>::trace(visitor); |
| 48 } | 40 } |
| 49 | 41 |
| 50 } // namespace blink | 42 } // namespace blink |
| OLD | NEW |