| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/service_worker/service_worker_content_settings_proxy_i
mpl.h" | 5 #include "content/browser/service_worker/service_worker_content_settings_proxy_i
mpl.h" |
| 6 | 6 |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void ServiceWorkerContentSettingsProxyImpl::AllowIndexedDB( | 33 void ServiceWorkerContentSettingsProxyImpl::AllowIndexedDB( |
| 34 const url::Origin& origin, | 34 const url::Origin& origin, |
| 35 const base::string16& name, | 35 const base::string16& name, |
| 36 AllowIndexedDBCallback callback) { | 36 AllowIndexedDBCallback callback) { |
| 37 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 37 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 38 if (!origin_.IsSameOriginWith(origin)) { | 38 if (!origin_.IsSameOriginWith(origin)) { |
| 39 mojo::ReportBadMessage("Origin is invalid"); | 39 mojo::ReportBadMessage("Origin is invalid"); |
| 40 std::move(callback).Run(false); | 40 std::move(callback).Run(false); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 if (origin_.unique()) { | 43 if (origin_.opaque()) { |
| 44 std::move(callback).Run(false); | 44 std::move(callback).Run(false); |
| 45 return; | 45 return; |
| 46 } | 46 } |
| 47 // |render_frames| is used to show UI for the frames affected by the | 47 // |render_frames| is used to show UI for the frames affected by the |
| 48 // content setting. However, service worker is not necessarily associated | 48 // content setting. However, service worker is not necessarily associated |
| 49 // with frames or making the request on behalf of frames, | 49 // with frames or making the request on behalf of frames, |
| 50 // so just pass an empty |render_frames|. | 50 // so just pass an empty |render_frames|. |
| 51 std::vector<std::pair<int, int>> render_frames; | 51 std::vector<std::pair<int, int>> render_frames; |
| 52 std::move(callback).Run(GetContentClient()->browser()->AllowWorkerIndexedDB( | 52 std::move(callback).Run(GetContentClient()->browser()->AllowWorkerIndexedDB( |
| 53 origin_.GetURL(), name, context_->wrapper()->resource_context(), | 53 origin_.GetURL(), name, context_->wrapper()->resource_context(), |
| 54 render_frames)); | 54 render_frames)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ServiceWorkerContentSettingsProxyImpl::RequestFileSystemAccessSync( | 57 void ServiceWorkerContentSettingsProxyImpl::RequestFileSystemAccessSync( |
| 58 const url::Origin& origin, | 58 const url::Origin& origin, |
| 59 RequestFileSystemAccessSyncCallback callback) { | 59 RequestFileSystemAccessSyncCallback callback) { |
| 60 mojo::ReportBadMessage( | 60 mojo::ReportBadMessage( |
| 61 "The FileSystem API is not exposed to service workers " | 61 "The FileSystem API is not exposed to service workers " |
| 62 "but somehow a service worker requested access."); | 62 "but somehow a service worker requested access."); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace content | 65 } // namespace content |
| OLD | NEW |