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/browser/script_executor.h" | 5 #include "extensions/browser/script_executor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 ~Handler() override {} | 48 ~Handler() override {} |
49 | 49 |
50 bool OnMessageReceived(const IPC::Message& message) override { | 50 bool OnMessageReceived(const IPC::Message& message) override { |
51 // Unpack by hand to check the request_id, since there may be multiple | 51 // Unpack by hand to check the request_id, since there may be multiple |
52 // requests in flight but only one is for this. | 52 // requests in flight but only one is for this. |
53 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) | 53 if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID) |
54 return false; | 54 return false; |
55 | 55 |
56 int message_request_id; | 56 int message_request_id; |
57 PickleIterator iter(message); | 57 base::PickleIterator iter(message); |
58 CHECK(iter.ReadInt(&message_request_id)); | 58 CHECK(iter.ReadInt(&message_request_id)); |
59 | 59 |
60 if (message_request_id != request_id_) | 60 if (message_request_id != request_id_) |
61 return false; | 61 return false; |
62 | 62 |
63 IPC_BEGIN_MESSAGE_MAP(Handler, message) | 63 IPC_BEGIN_MESSAGE_MAP(Handler, message) |
64 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ExecuteCodeFinished, | 64 IPC_MESSAGE_HANDLER(ExtensionHostMsg_ExecuteCodeFinished, |
65 OnExecuteCodeFinished) | 65 OnExecuteCodeFinished) |
66 IPC_END_MESSAGE_MAP() | 66 IPC_END_MESSAGE_MAP() |
67 return true; | 67 return true; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 params.webview_src = webview_src; | 151 params.webview_src = webview_src; |
152 params.file_url = file_url; | 152 params.file_url = file_url; |
153 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); | 153 params.wants_result = (result_type == JSON_SERIALIZED_RESULT); |
154 params.user_gesture = user_gesture; | 154 params.user_gesture = user_gesture; |
155 | 155 |
156 // Handler handles IPCs and deletes itself on completion. | 156 // Handler handles IPCs and deletes itself on completion. |
157 new Handler(script_observers_, web_contents_, params, callback); | 157 new Handler(script_observers_, web_contents_, params, callback); |
158 } | 158 } |
159 | 159 |
160 } // namespace extensions | 160 } // namespace extensions |
OLD | NEW |