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" | 9 #include "public/platform/modules/permissions/WebPermissionClient.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 PermissionController::~PermissionController() | 13 PermissionController::~PermissionController() |
14 { | 14 { |
15 } | 15 } |
16 | 16 |
17 void PermissionController::provideTo(LocalFrame& frame, WebPermissionClient* cli
ent) | 17 void PermissionController::provideTo(LocalFrame& frame, WebPermissionClient* cli
ent) |
18 { | 18 { |
19 ASSERT(RuntimeEnabledFeatures::permissionsEnabled()); | 19 ASSERT(RuntimeEnabledFeatures::permissionsEnabled()); |
20 | 20 |
21 PermissionController* controller = new PermissionController(frame, client); | 21 PermissionController* controller = new PermissionController(frame, client); |
22 HeapSupplement<LocalFrame>::provideTo(frame, supplementName(), controller); | 22 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); |
23 } | 23 } |
24 | 24 |
25 PermissionController* PermissionController::from(LocalFrame& frame) | 25 PermissionController* PermissionController::from(LocalFrame& frame) |
26 { | 26 { |
27 return static_cast<PermissionController*>(HeapSupplement<LocalFrame>::from(f
rame, supplementName())); | 27 return static_cast<PermissionController*>(Supplement<LocalFrame>::from(frame
, supplementName())); |
28 } | 28 } |
29 | 29 |
30 PermissionController::PermissionController(LocalFrame& frame, WebPermissionClien
t* client) | 30 PermissionController::PermissionController(LocalFrame& frame, WebPermissionClien
t* client) |
31 : LocalFrameLifecycleObserver(&frame) | 31 : LocalFrameLifecycleObserver(&frame) |
32 , m_client(client) | 32 , m_client(client) |
33 { | 33 { |
34 } | 34 } |
35 | 35 |
36 const char* PermissionController::supplementName() | 36 const char* PermissionController::supplementName() |
37 { | 37 { |
38 return "PermissionController"; | 38 return "PermissionController"; |
39 } | 39 } |
40 | 40 |
41 WebPermissionClient* PermissionController::client() const | 41 WebPermissionClient* PermissionController::client() const |
42 { | 42 { |
43 return m_client; | 43 return m_client; |
44 } | 44 } |
45 | 45 |
46 void PermissionController::willDetachFrameHost() | 46 void PermissionController::willDetachFrameHost() |
47 { | 47 { |
48 m_client = nullptr; | 48 m_client = nullptr; |
49 } | 49 } |
50 | 50 |
51 DEFINE_TRACE(PermissionController) | 51 DEFINE_TRACE(PermissionController) |
52 { | 52 { |
53 LocalFrameLifecycleObserver::trace(visitor); | 53 LocalFrameLifecycleObserver::trace(visitor); |
54 HeapSupplement<LocalFrame>::trace(visitor); | 54 Supplement<LocalFrame>::trace(visitor); |
55 } | 55 } |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
OLD | NEW |