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/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_messages.h" | 16 #include "chrome/common/extensions/extension_messages.h" |
17 #include "chrome/common/extensions/manifest.h" | 17 #include "chrome/common/extensions/manifest.h" |
| 18 #include "chrome/common/extensions/message_bundle.h" |
18 #include "chrome/common/extensions/permissions/permission_set.h" | 19 #include "chrome/common/extensions/permissions/permission_set.h" |
19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
20 #include "chrome/common/view_type.h" | 21 #include "chrome/common/view_type.h" |
21 #include "chrome/renderer/chrome_render_process_observer.h" | 22 #include "chrome/renderer/chrome_render_process_observer.h" |
22 #include "chrome/renderer/extensions/api_definitions_natives.h" | 23 #include "chrome/renderer/extensions/api_definitions_natives.h" |
23 #include "chrome/renderer/extensions/app_bindings.h" | 24 #include "chrome/renderer/extensions/app_bindings.h" |
24 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 25 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
25 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 26 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
26 #include "chrome/renderer/extensions/chrome_v8_context.h" | 27 #include "chrome/renderer/extensions/chrome_v8_context.h" |
27 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 28 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 extensions_.Remove(id); | 508 extensions_.Remove(id); |
508 active_extension_ids_.erase(id); | 509 active_extension_ids_.erase(id); |
509 | 510 |
510 // If the extension is later reloaded with a different set of permissions, | 511 // If the extension is later reloaded with a different set of permissions, |
511 // we'd like it to get a new isolated world ID, so that it can pick up the | 512 // we'd like it to get a new isolated world ID, so that it can pick up the |
512 // changed origin whitelist. | 513 // changed origin whitelist. |
513 user_script_slave_->RemoveIsolatedWorld(id); | 514 user_script_slave_->RemoveIsolatedWorld(id); |
514 | 515 |
515 v8_context_set_.OnExtensionUnloaded(id); | 516 v8_context_set_.OnExtensionUnloaded(id); |
516 | 517 |
| 518 // Invalidates the messages map for the extension in case the extension is |
| 519 // reloaded with a new messages map. |
| 520 EraseL10nMessagesMap(id); |
| 521 |
517 // We don't do anything with existing platform-app stylesheets. They will | 522 // We don't do anything with existing platform-app stylesheets. They will |
518 // stay resident, but the URL pattern corresponding to the unloaded | 523 // stay resident, but the URL pattern corresponding to the unloaded |
519 // extension's URL just won't match anything anymore. | 524 // extension's URL just won't match anything anymore. |
520 } | 525 } |
521 | 526 |
522 void Dispatcher::OnSetScriptingWhitelist( | 527 void Dispatcher::OnSetScriptingWhitelist( |
523 const Extension::ScriptingWhitelist& extension_ids) { | 528 const Extension::ScriptingWhitelist& extension_ids) { |
524 Extension::SetScriptingWhitelist(extension_ids); | 529 Extension::SetScriptingWhitelist(extension_ids); |
525 } | 530 } |
526 | 531 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1159 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1155 v8::ThrowException( | 1160 v8::ThrowException( |
1156 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1161 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1157 return false; | 1162 return false; |
1158 } | 1163 } |
1159 | 1164 |
1160 return true; | 1165 return true; |
1161 } | 1166 } |
1162 | 1167 |
1163 } // namespace extensions | 1168 } // namespace extensions |
OLD | NEW |