| 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 "extensions/renderer/renderer_extension_registry.h" | 5 #include "extensions/renderer/renderer_extension_registry.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // This can only be modified on the RenderThread, because | 31 // This can only be modified on the RenderThread, because |
| 32 // GetMainThreadExtensionSet is inherently thread unsafe. | 32 // GetMainThreadExtensionSet is inherently thread unsafe. |
| 33 // Enforcing single-thread modification at least mitigates this. | 33 // Enforcing single-thread modification at least mitigates this. |
| 34 // TODO(annekao): Remove this restriction once GetMainThreadExtensionSet is | 34 // TODO(annekao): Remove this restriction once GetMainThreadExtensionSet is |
| 35 // fixed. | 35 // fixed. |
| 36 DCHECK(content::RenderThread::Get()); | 36 DCHECK(content::RenderThread::Get()); |
| 37 base::AutoLock lock(lock_); | 37 base::AutoLock lock(lock_); |
| 38 return &extensions_; | 38 return &extensions_; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void RendererExtensionRegistry::SetWebviewPartitionID( |
| 42 const std::string& partition_id) { |
| 43 // |webview_partition_id_| cannot be changed once set. |
| 44 DCHECK(webview_partition_id_.empty() || |
| 45 webview_partition_id_ == partition_id); |
| 46 if (webview_partition_id_.empty()) |
| 47 webview_partition_id_ = partition_id; |
| 48 } |
| 49 |
| 41 size_t RendererExtensionRegistry::size() const { | 50 size_t RendererExtensionRegistry::size() const { |
| 42 base::AutoLock lock(lock_); | 51 base::AutoLock lock(lock_); |
| 43 return extensions_.size(); | 52 return extensions_.size(); |
| 44 } | 53 } |
| 45 | 54 |
| 46 bool RendererExtensionRegistry::is_empty() const { | 55 bool RendererExtensionRegistry::is_empty() const { |
| 47 base::AutoLock lock(lock_); | 56 base::AutoLock lock(lock_); |
| 48 return extensions_.is_empty(); | 57 return extensions_.is_empty(); |
| 49 } | 58 } |
| 50 | 59 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return extensions_.GetIDs(); | 105 return extensions_.GetIDs(); |
| 97 } | 106 } |
| 98 | 107 |
| 99 bool RendererExtensionRegistry::ExtensionBindingsAllowed( | 108 bool RendererExtensionRegistry::ExtensionBindingsAllowed( |
| 100 const GURL& url) const { | 109 const GURL& url) const { |
| 101 base::AutoLock lock(lock_); | 110 base::AutoLock lock(lock_); |
| 102 return extensions_.ExtensionBindingsAllowed(url); | 111 return extensions_.ExtensionBindingsAllowed(url); |
| 103 } | 112 } |
| 104 | 113 |
| 105 } // namespace extensions | 114 } // namespace extensions |
| OLD | NEW |