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/quota/StorageManager.h" | 5 #include "modules/quota/StorageManager.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "bindings/modules/v8/V8StorageEstimate.h" | 8 #include "bindings/modules/v8/V8StorageEstimate.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 new EstimateCallbacks(resolver)); | 135 new EstimateCallbacks(resolver)); |
136 return promise; | 136 return promise; |
137 } | 137 } |
138 | 138 |
139 DEFINE_TRACE(StorageManager) {} | 139 DEFINE_TRACE(StorageManager) {} |
140 | 140 |
141 PermissionService* StorageManager::getPermissionService( | 141 PermissionService* StorageManager::getPermissionService( |
142 ExecutionContext* executionContext) { | 142 ExecutionContext* executionContext) { |
143 if (!m_permissionService && | 143 if (!m_permissionService && |
144 connectToPermissionService(executionContext, | 144 connectToPermissionService(executionContext, |
145 mojo::GetProxy(&m_permissionService))) | 145 mojo::MakeRequest(&m_permissionService))) |
146 m_permissionService.set_connection_error_handler(convertToBaseCallback( | 146 m_permissionService.set_connection_error_handler(convertToBaseCallback( |
147 WTF::bind(&StorageManager::permissionServiceConnectionError, | 147 WTF::bind(&StorageManager::permissionServiceConnectionError, |
148 wrapWeakPersistent(this)))); | 148 wrapWeakPersistent(this)))); |
149 return m_permissionService.get(); | 149 return m_permissionService.get(); |
150 } | 150 } |
151 | 151 |
152 void StorageManager::permissionServiceConnectionError() { | 152 void StorageManager::permissionServiceConnectionError() { |
153 if (!Platform::current()) { | 153 if (!Platform::current()) { |
154 // TODO(rockot): Clean this up once renderer shutdown sequence is fixed. | 154 // TODO(rockot): Clean this up once renderer shutdown sequence is fixed. |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 m_permissionService.reset(); | 158 m_permissionService.reset(); |
159 } | 159 } |
160 | 160 |
161 void StorageManager::permissionRequestComplete(ScriptPromiseResolver* resolver, | 161 void StorageManager::permissionRequestComplete(ScriptPromiseResolver* resolver, |
162 PermissionStatus status) { | 162 PermissionStatus status) { |
163 if (!resolver->getExecutionContext() || | 163 if (!resolver->getExecutionContext() || |
164 resolver->getExecutionContext()->isContextDestroyed()) | 164 resolver->getExecutionContext()->isContextDestroyed()) |
165 return; | 165 return; |
166 resolver->resolve(status == PermissionStatus::GRANTED); | 166 resolver->resolve(status == PermissionStatus::GRANTED); |
167 } | 167 } |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
OLD | NEW |