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 "config.h" | 5 #include "config.h" |
6 #include "modules/permissions/NavigatorPermissions.h" | 6 #include "modules/permissions/NavigatorPermissions.h" |
7 | 7 |
8 #include "core/frame/Navigator.h" | 8 #include "core/frame/Navigator.h" |
9 #include "modules/permissions/Permissions.h" | 9 #include "modules/permissions/Permissions.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 NavigatorPermissions::NavigatorPermissions() | 13 NavigatorPermissions::NavigatorPermissions() |
14 { | 14 { |
15 } | 15 } |
16 | 16 |
17 NavigatorPermissions::~NavigatorPermissions() | |
18 { | |
19 } | |
20 | |
21 // static | 17 // static |
22 const char* NavigatorPermissions::supplementName() | 18 const char* NavigatorPermissions::supplementName() |
23 { | 19 { |
24 return "NavigatorPermissions"; | 20 return "NavigatorPermissions"; |
25 } | 21 } |
26 | 22 |
27 // static | 23 // static |
28 NavigatorPermissions& NavigatorPermissions::from(Navigator& navigator) | 24 NavigatorPermissions& NavigatorPermissions::from(Navigator& navigator) |
29 { | 25 { |
30 NavigatorPermissions* supplement = static_cast<NavigatorPermissions*>(WillBe
HeapSupplement<Navigator>::from(navigator, supplementName())); | 26 NavigatorPermissions* supplement = static_cast<NavigatorPermissions*>(HeapSu
pplement<Navigator>::from(navigator, supplementName())); |
31 if (!supplement) { | 27 if (!supplement) { |
32 supplement = new NavigatorPermissions(); | 28 supplement = new NavigatorPermissions(); |
33 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 29 provideTo(navigator, supplementName(), supplement); |
34 } | 30 } |
35 return *supplement; | 31 return *supplement; |
36 } | 32 } |
37 | 33 |
38 // static | 34 // static |
39 Permissions* NavigatorPermissions::permissions(Navigator& navigator) | 35 Permissions* NavigatorPermissions::permissions(Navigator& navigator) |
40 { | 36 { |
41 NavigatorPermissions& self = NavigatorPermissions::from(navigator); | 37 NavigatorPermissions& self = NavigatorPermissions::from(navigator); |
42 if (!self.m_permissions) | 38 if (!self.m_permissions) |
43 self.m_permissions = new Permissions(); | 39 self.m_permissions = new Permissions(); |
44 return self.m_permissions.get(); | 40 return self.m_permissions.get(); |
45 } | 41 } |
46 | 42 |
47 DEFINE_TRACE(NavigatorPermissions) | 43 DEFINE_TRACE(NavigatorPermissions) |
48 { | 44 { |
49 visitor->trace(m_permissions); | 45 visitor->trace(m_permissions); |
50 WillBeHeapSupplement<Navigator>::trace(visitor); | 46 HeapSupplement<Navigator>::trace(visitor); |
51 } | 47 } |
52 | 48 |
53 } // namespace blink | 49 } // namespace blink |
OLD | NEW |