| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/user_script_set_manager.h" | 5 #include "extensions/renderer/user_script_set_manager.h" |
| 6 | 6 |
| 7 #include "components/crx_file/id_util.h" | 7 #include "components/crx_file/id_util.h" |
| 8 #include "content/public/renderer/render_thread.h" | 8 #include "content/public/renderer/render_thread.h" |
| 9 #include "extensions/common/extension_messages.h" | 9 #include "extensions/common/extension_messages.h" |
| 10 #include "extensions/renderer/dispatcher.h" | 10 #include "extensions/renderer/dispatcher.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 void UserScriptSetManager::RemoveObserver(Observer* observer) { | 31 void UserScriptSetManager::RemoveObserver(Observer* observer) { |
| 32 observers_.RemoveObserver(observer); | 32 observers_.RemoveObserver(observer); |
| 33 } | 33 } |
| 34 | 34 |
| 35 scoped_ptr<ScriptInjection> | 35 scoped_ptr<ScriptInjection> |
| 36 UserScriptSetManager::GetInjectionForDeclarativeScript( | 36 UserScriptSetManager::GetInjectionForDeclarativeScript( |
| 37 int script_id, | 37 int script_id, |
| 38 blink::WebFrame* web_frame, | 38 blink::WebFrame* web_frame, |
| 39 int tab_id, | 39 int tab_id, |
| 40 const GURL& url, | 40 const GURL& url, |
| 41 const Extension* extension) { | 41 const std::string& extension_id) { |
| 42 UserScriptSet* user_script_set = | 42 UserScriptSet* user_script_set = |
| 43 GetProgrammaticScriptsByExtension(extension->id()); | 43 GetProgrammaticScriptsByExtension(extension_id); |
| 44 if (!user_script_set) | 44 if (!user_script_set) |
| 45 return scoped_ptr<ScriptInjection>(); | 45 return scoped_ptr<ScriptInjection>(); |
| 46 | 46 |
| 47 return user_script_set->GetDeclarativeScriptInjection( | 47 return user_script_set->GetDeclarativeScriptInjection( |
| 48 script_id, | 48 script_id, |
| 49 web_frame, | 49 web_frame, |
| 50 tab_id, | 50 tab_id, |
| 51 UserScript::BROWSER_DRIVEN, | 51 UserScript::BROWSER_DRIVEN, |
| 52 url, | 52 url); |
| 53 extension); | |
| 54 } | 53 } |
| 55 | 54 |
| 56 bool UserScriptSetManager::OnControlMessageReceived( | 55 bool UserScriptSetManager::OnControlMessageReceived( |
| 57 const IPC::Message& message) { | 56 const IPC::Message& message) { |
| 58 bool handled = true; | 57 bool handled = true; |
| 59 IPC_BEGIN_MESSAGE_MAP(UserScriptSetManager, message) | 58 IPC_BEGIN_MESSAGE_MAP(UserScriptSetManager, message) |
| 60 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateUserScripts, OnUpdateUserScripts) | 59 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateUserScripts, OnUpdateUserScripts) |
| 61 IPC_MESSAGE_UNHANDLED(handled = false) | 60 IPC_MESSAGE_UNHANDLED(handled = false) |
| 62 IPC_END_MESSAGE_MAP() | 61 IPC_END_MESSAGE_MAP() |
| 63 return handled; | 62 return handled; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 148 |
| 150 if (scripts->UpdateUserScripts(shared_memory, *effective_extensions)) { | 149 if (scripts->UpdateUserScripts(shared_memory, *effective_extensions)) { |
| 151 FOR_EACH_OBSERVER( | 150 FOR_EACH_OBSERVER( |
| 152 Observer, | 151 Observer, |
| 153 observers_, | 152 observers_, |
| 154 OnUserScriptsUpdated(*effective_extensions, scripts->scripts())); | 153 OnUserScriptsUpdated(*effective_extensions, scripts->scripts())); |
| 155 } | 154 } |
| 156 } | 155 } |
| 157 | 156 |
| 158 } // namespace extensions | 157 } // namespace extensions |
| OLD | NEW |