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/browser/extensions/script_executor.h" | 5 #include "chrome/browser/extensions/script_executor.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "chrome/common/extensions/extension_messages.h" | 10 #include "chrome/common/extensions/extension_messages.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 callback_.Run(kRendererDestroyed, -1, GURL(std::string()), val); | 69 callback_.Run(kRendererDestroyed, -1, GURL(std::string()), val); |
70 delete this; | 70 delete this; |
71 } | 71 } |
72 | 72 |
73 private: | 73 private: |
74 void OnExecuteCodeFinished(int request_id, | 74 void OnExecuteCodeFinished(int request_id, |
75 const std::string& error, | 75 const std::string& error, |
76 int32 on_page_id, | 76 int32 on_page_id, |
77 const GURL& on_url, | 77 const GURL& on_url, |
78 const base::ListValue& script_result) { | 78 const base::ListValue& script_result) { |
79 if (script_observers_ && error.empty()) { | 79 if (script_observers_.get() && error.empty()) { |
80 TabHelper::ScriptExecutionObserver::ExecutingScriptsMap id_map; | 80 TabHelper::ScriptExecutionObserver::ExecutingScriptsMap id_map; |
81 id_map[extension_id_] = std::set<std::string>(); | 81 id_map[extension_id_] = std::set<std::string>(); |
82 FOR_EACH_OBSERVER(TabHelper::ScriptExecutionObserver, *script_observers_, | 82 FOR_EACH_OBSERVER(TabHelper::ScriptExecutionObserver, *script_observers_, |
83 OnScriptsExecuted(web_contents(), | 83 OnScriptsExecuted(web_contents(), |
84 id_map, | 84 id_map, |
85 on_page_id, | 85 on_page_id, |
86 on_url)); | 86 on_url)); |
87 } | 87 } |
88 | 88 |
89 callback_.Run(error, on_page_id, on_url, script_result); | 89 callback_.Run(error, on_page_id, on_url, script_result); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 params.all_frames = (frame_scope == ALL_FRAMES); | 125 params.all_frames = (frame_scope == ALL_FRAMES); |
126 params.run_at = static_cast<int>(run_at); | 126 params.run_at = static_cast<int>(run_at); |
127 params.in_main_world = (world_type == MAIN_WORLD); | 127 params.in_main_world = (world_type == MAIN_WORLD); |
128 params.is_web_view = is_web_view; | 128 params.is_web_view = is_web_view; |
129 | 129 |
130 // Handler handles IPCs and deletes itself on completion. | 130 // Handler handles IPCs and deletes itself on completion. |
131 new Handler(script_observers_, web_contents_, params, callback); | 131 new Handler(script_observers_, web_contents_, params, callback); |
132 } | 132 } |
133 | 133 |
134 } // namespace extensions | 134 } // namespace extensions |
OLD | NEW |