OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "chrome/common/child_process_logging.h" | 11 #include "chrome/common/child_process_logging.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
14 #include "chrome/common/extensions/api/extension_api.h" | 14 #include "chrome/common/extensions/api/extension_api.h" |
15 #include "chrome/common/extensions/background_info.h" | 15 #include "chrome/common/extensions/background_info.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/extensions/extension_messages.h" | 17 #include "chrome/common/extensions/extension_messages.h" |
18 #include "chrome/common/extensions/manifest.h" | 18 #include "chrome/common/extensions/manifest.h" |
19 #include "chrome/common/extensions/message_bundle.h" | |
19 #include "chrome/common/extensions/permissions/permission_set.h" | 20 #include "chrome/common/extensions/permissions/permission_set.h" |
20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
21 #include "chrome/common/view_type.h" | 22 #include "chrome/common/view_type.h" |
22 #include "chrome/renderer/chrome_render_process_observer.h" | 23 #include "chrome/renderer/chrome_render_process_observer.h" |
23 #include "chrome/renderer/extensions/api_definitions_natives.h" | 24 #include "chrome/renderer/extensions/api_definitions_natives.h" |
24 #include "chrome/renderer/extensions/app_bindings.h" | 25 #include "chrome/renderer/extensions/app_bindings.h" |
25 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 26 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
26 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 27 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
27 #include "chrome/renderer/extensions/chrome_v8_context.h" | 28 #include "chrome/renderer/extensions/chrome_v8_context.h" |
28 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 29 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 extensions_.Remove(id); | 509 extensions_.Remove(id); |
509 active_extension_ids_.erase(id); | 510 active_extension_ids_.erase(id); |
510 | 511 |
511 // If the extension is later reloaded with a different set of permissions, | 512 // If the extension is later reloaded with a different set of permissions, |
512 // we'd like it to get a new isolated world ID, so that it can pick up the | 513 // we'd like it to get a new isolated world ID, so that it can pick up the |
513 // changed origin whitelist. | 514 // changed origin whitelist. |
514 user_script_slave_->RemoveIsolatedWorld(id); | 515 user_script_slave_->RemoveIsolatedWorld(id); |
515 | 516 |
516 v8_context_set_.OnExtensionUnloaded(id); | 517 v8_context_set_.OnExtensionUnloaded(id); |
517 | 518 |
519 // Invalidates the messages map for the extension in case the extension is | |
Yoyo Zhou
2013/03/08 22:17:50
By the way, the CL description is way too verbose
Patrick Riordan
2013/03/11 17:32:42
Done.
| |
520 // reloaded with a new messages map. | |
521 EraseL10nMessagesMap(id); | |
522 | |
518 // We don't do anything with existing platform-app stylesheets. They will | 523 // We don't do anything with existing platform-app stylesheets. They will |
519 // stay resident, but the URL pattern corresponding to the unloaded | 524 // stay resident, but the URL pattern corresponding to the unloaded |
520 // extension's URL just won't match anything anymore. | 525 // extension's URL just won't match anything anymore. |
521 } | 526 } |
522 | 527 |
523 void Dispatcher::OnSetScriptingWhitelist( | 528 void Dispatcher::OnSetScriptingWhitelist( |
524 const Extension::ScriptingWhitelist& extension_ids) { | 529 const Extension::ScriptingWhitelist& extension_ids) { |
525 Extension::SetScriptingWhitelist(extension_ids); | 530 Extension::SetScriptingWhitelist(extension_ids); |
526 } | 531 } |
527 | 532 |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1163 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1168 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1164 v8::ThrowException( | 1169 v8::ThrowException( |
1165 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1170 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1166 return false; | 1171 return false; |
1167 } | 1172 } |
1168 | 1173 |
1169 return true; | 1174 return true; |
1170 } | 1175 } |
1171 | 1176 |
1172 } // namespace extensions | 1177 } // namespace extensions |
OLD | NEW |