| 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 "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "chrome/common/child_process_logging.h" | 12 #include "chrome/common/child_process_logging.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/chrome_version_info.h" | 14 #include "chrome/common/chrome_version_info.h" |
| 15 #include "chrome/common/extensions/api/extension_api.h" | 15 #include "chrome/common/extensions/api/extension_api.h" |
| 16 #include "chrome/common/extensions/background_info.h" | 16 #include "chrome/common/extensions/background_info.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
| 19 #include "chrome/common/extensions/features/feature.h" | 19 #include "chrome/common/extensions/features/feature.h" |
| 20 #include "chrome/common/extensions/manifest.h" | 20 #include "chrome/common/extensions/manifest.h" |
| 21 #include "chrome/common/extensions/message_bundle.h" |
| 21 #include "chrome/common/extensions/permissions/permission_set.h" | 22 #include "chrome/common/extensions/permissions/permission_set.h" |
| 22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 23 #include "chrome/common/view_type.h" | 24 #include "chrome/common/view_type.h" |
| 24 #include "chrome/renderer/chrome_render_process_observer.h" | 25 #include "chrome/renderer/chrome_render_process_observer.h" |
| 25 #include "chrome/renderer/extensions/api_definitions_natives.h" | 26 #include "chrome/renderer/extensions/api_definitions_natives.h" |
| 26 #include "chrome/renderer/extensions/app_bindings.h" | 27 #include "chrome/renderer/extensions/app_bindings.h" |
| 27 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 28 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
| 28 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 29 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
| 29 #include "chrome/renderer/extensions/binding_generating_native_handler.h" | 30 #include "chrome/renderer/extensions/binding_generating_native_handler.h" |
| 30 #include "chrome/renderer/extensions/chrome_v8_context.h" | 31 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 extensions_.Remove(id); | 573 extensions_.Remove(id); |
| 573 active_extension_ids_.erase(id); | 574 active_extension_ids_.erase(id); |
| 574 | 575 |
| 575 // If the extension is later reloaded with a different set of permissions, | 576 // If the extension is later reloaded with a different set of permissions, |
| 576 // we'd like it to get a new isolated world ID, so that it can pick up the | 577 // we'd like it to get a new isolated world ID, so that it can pick up the |
| 577 // changed origin whitelist. | 578 // changed origin whitelist. |
| 578 user_script_slave_->RemoveIsolatedWorld(id); | 579 user_script_slave_->RemoveIsolatedWorld(id); |
| 579 | 580 |
| 580 v8_context_set_.OnExtensionUnloaded(id); | 581 v8_context_set_.OnExtensionUnloaded(id); |
| 581 | 582 |
| 583 // Invalidates the messages map for the extension in case the extension is |
| 584 // reloaded with a new messages map. |
| 585 EraseL10nMessagesMap(id); |
| 586 |
| 582 // We don't do anything with existing platform-app stylesheets. They will | 587 // We don't do anything with existing platform-app stylesheets. They will |
| 583 // stay resident, but the URL pattern corresponding to the unloaded | 588 // stay resident, but the URL pattern corresponding to the unloaded |
| 584 // extension's URL just won't match anything anymore. | 589 // extension's URL just won't match anything anymore. |
| 585 } | 590 } |
| 586 | 591 |
| 587 void Dispatcher::OnSetScriptingWhitelist( | 592 void Dispatcher::OnSetScriptingWhitelist( |
| 588 const Extension::ScriptingWhitelist& extension_ids) { | 593 const Extension::ScriptingWhitelist& extension_ids) { |
| 589 Extension::SetScriptingWhitelist(extension_ids); | 594 Extension::SetScriptingWhitelist(extension_ids); |
| 590 } | 595 } |
| 591 | 596 |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1321 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 1317 v8::ThrowException( | 1322 v8::ThrowException( |
| 1318 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1323 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 1319 return false; | 1324 return false; |
| 1320 } | 1325 } |
| 1321 | 1326 |
| 1322 return true; | 1327 return true; |
| 1323 } | 1328 } |
| 1324 | 1329 |
| 1325 } // namespace extensions | 1330 } // namespace extensions |
| OLD | NEW |