OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
4 * Copyright 2010, The Android Open Source Project | 4 * Copyright 2010, The Android Open Source Project |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 Geolocation* Geolocation::create(ExecutionContext* context) | 87 Geolocation* Geolocation::create(ExecutionContext* context) |
88 { | 88 { |
89 Geolocation* geolocation = new Geolocation(context); | 89 Geolocation* geolocation = new Geolocation(context); |
90 return geolocation; | 90 return geolocation; |
91 } | 91 } |
92 | 92 |
93 Geolocation::Geolocation(ExecutionContext* context) | 93 Geolocation::Geolocation(ExecutionContext* context) |
94 : ContextLifecycleObserver(context) | 94 : ContextLifecycleObserver(context) |
95 , PageLifecycleObserver(document()->page()) | 95 , PageVisibilityObserver(document()->page()) |
96 , m_geolocationPermission(PermissionUnknown) | 96 , m_geolocationPermission(PermissionUnknown) |
97 { | 97 { |
98 } | 98 } |
99 | 99 |
100 Geolocation::~Geolocation() | 100 Geolocation::~Geolocation() |
101 { | 101 { |
102 DCHECK(m_geolocationPermission != PermissionRequested); | 102 DCHECK(m_geolocationPermission != PermissionRequested); |
103 } | 103 } |
104 | 104 |
105 DEFINE_TRACE(Geolocation) | 105 DEFINE_TRACE(Geolocation) |
106 { | 106 { |
107 visitor->trace(m_oneShots); | 107 visitor->trace(m_oneShots); |
108 visitor->trace(m_watchers); | 108 visitor->trace(m_watchers); |
109 visitor->trace(m_pendingForPermissionNotifiers); | 109 visitor->trace(m_pendingForPermissionNotifiers); |
110 visitor->trace(m_lastPosition); | 110 visitor->trace(m_lastPosition); |
111 ContextLifecycleObserver::trace(visitor); | 111 ContextLifecycleObserver::trace(visitor); |
112 PageLifecycleObserver::trace(visitor); | 112 PageVisibilityObserver::trace(visitor); |
113 } | 113 } |
114 | 114 |
115 Document* Geolocation::document() const | 115 Document* Geolocation::document() const |
116 { | 116 { |
117 return toDocument(getExecutionContext()); | 117 return toDocument(getExecutionContext()); |
118 } | 118 } |
119 | 119 |
120 LocalFrame* Geolocation::frame() const | 120 LocalFrame* Geolocation::frame() const |
121 { | 121 { |
122 return document() ? document()->frame() : 0; | 122 return document() ? document()->frame() : 0; |
123 } | 123 } |
124 | 124 |
125 void Geolocation::contextDestroyed() | 125 void Geolocation::contextDestroyed() |
126 { | 126 { |
127 m_permissionService.reset(); | 127 m_permissionService.reset(); |
128 cancelAllRequests(); | 128 cancelAllRequests(); |
129 stopUpdating(); | 129 stopUpdating(); |
130 m_geolocationPermission = PermissionDenied; | 130 m_geolocationPermission = PermissionDenied; |
131 m_pendingForPermissionNotifiers.clear(); | 131 m_pendingForPermissionNotifiers.clear(); |
132 m_lastPosition = nullptr; | 132 m_lastPosition = nullptr; |
133 ContextLifecycleObserver::clearContext(); | 133 ContextLifecycleObserver::clearContext(); |
134 PageLifecycleObserver::clearContext(); | 134 PageVisibilityObserver::clearContext(); |
135 } | 135 } |
136 | 136 |
137 void Geolocation::recordOriginTypeAccess() const | 137 void Geolocation::recordOriginTypeAccess() const |
138 { | 138 { |
139 DCHECK(frame()); | 139 DCHECK(frame()); |
140 | 140 |
141 Document* document = this->document(); | 141 Document* document = this->document(); |
142 DCHECK(document); | 142 DCHECK(document); |
143 | 143 |
144 // It is required by isSecureContext() but isn't | 144 // It is required by isSecureContext() but isn't |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 error->setIsFatal(true); | 530 error->setIsFatal(true); |
531 handleError(error); | 531 handleError(error); |
532 } | 532 } |
533 | 533 |
534 void Geolocation::onPermissionConnectionError() | 534 void Geolocation::onPermissionConnectionError() |
535 { | 535 { |
536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); | 536 onGeolocationPermissionUpdated(mojom::blink::PermissionStatus::DENIED); |
537 } | 537 } |
538 | 538 |
539 } // namespace blink | 539 } // namespace blink |
OLD | NEW |