OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/extensions/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_process_logging.h" | 8 #include "chrome/common/child_process_logging.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 scoped_refptr<const Extension> extension(params.ConvertToExtension()); | 144 scoped_refptr<const Extension> extension(params.ConvertToExtension()); |
145 if (!extension) { | 145 if (!extension) { |
146 // This can happen if extension parsing fails for any reason. One reason | 146 // This can happen if extension parsing fails for any reason. One reason |
147 // this can legitimately happen is if the | 147 // this can legitimately happen is if the |
148 // --enable-experimental-extension-apis changes at runtime, which happens | 148 // --enable-experimental-extension-apis changes at runtime, which happens |
149 // during browser tests. Existing renderers won't know about the change. | 149 // during browser tests. Existing renderers won't know about the change. |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 extensions_.Insert(extension); | 153 extensions_.Insert(extension); |
154 extension->SetActivePermissions(params.GetActivePermissions()); | |
155 } | 154 } |
156 | 155 |
157 void ExtensionDispatcher::OnUnloaded(const std::string& id) { | 156 void ExtensionDispatcher::OnUnloaded(const std::string& id) { |
158 extensions_.Remove(id); | 157 extensions_.Remove(id); |
159 // If the extension is later reloaded with a different set of permissions, | 158 // If the extension is later reloaded with a different set of permissions, |
160 // we'd like it to get a new isolated world ID, so that it can pick up the | 159 // we'd like it to get a new isolated world ID, so that it can pick up the |
161 // changed origin whitelist. | 160 // changed origin whitelist. |
162 UserScriptSlave::RemoveIsolatedWorld(id); | 161 UserScriptSlave::RemoveIsolatedWorld(id); |
163 } | 162 } |
164 | 163 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 child_process_logging::SetActiveExtensions(active_extensions); | 325 child_process_logging::SetActiveExtensions(active_extensions); |
327 } | 326 } |
328 | 327 |
329 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, | 328 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, |
330 bool restrict_to_extensions) { | 329 bool restrict_to_extensions) { |
331 if (restrict_to_extensions) | 330 if (restrict_to_extensions) |
332 restricted_v8_extensions_.insert(extension->name()); | 331 restricted_v8_extensions_.insert(extension->name()); |
333 | 332 |
334 RenderThread::current()->RegisterExtension(extension); | 333 RenderThread::current()->RegisterExtension(extension); |
335 } | 334 } |
OLD | NEW |