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 "content/utility/utility_thread_impl.h" | 5 #include "content/utility/utility_thread_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "content/common/child_process.h" | 12 #include "content/common/child_process.h" |
13 #include "content/common/child_process_messages.h" | 13 #include "content/common/child_process_messages.h" |
14 #include "content/common/indexed_db/indexed_db_key.h" | 14 #include "content/common/indexed_db/indexed_db_key.h" |
jsbell
2012/08/21 18:53:13
Can this include be removed?
| |
15 #include "content/common/indexed_db/indexed_db_key_path.h" | 15 #include "content/common/indexed_db/indexed_db_key_path.h" |
jsbell
2012/08/21 18:53:13
Ditto?
| |
16 #include "content/common/utility_messages.h" | 16 #include "content/common/utility_messages.h" |
17 #include "content/common/webkitplatformsupport_impl.h" | 17 #include "content/common/webkitplatformsupport_impl.h" |
18 #include "content/public/utility/content_utility_client.h" | 18 #include "content/public/utility/content_utility_client.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize dScriptValue.h" |
22 #include "webkit/glue/idb_bindings.h" | |
23 #include "webkit/plugins/npapi/plugin_list.h" | 21 #include "webkit/plugins/npapi/plugin_list.h" |
24 | 22 |
25 #if defined(TOOLKIT_GTK) | 23 #if defined(TOOLKIT_GTK) |
26 #include <gtk/gtk.h> | 24 #include <gtk/gtk.h> |
27 | 25 |
28 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
29 #endif | 27 #endif |
30 | 28 |
31 namespace { | 29 namespace { |
32 | 30 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 | 70 |
73 #endif // OS_WIN | 71 #endif // OS_WIN |
74 | 72 |
75 | 73 |
76 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 74 bool UtilityThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
77 if (content::GetContentClient()->utility()->OnMessageReceived(msg)) | 75 if (content::GetContentClient()->utility()->OnMessageReceived(msg)) |
78 return true; | 76 return true; |
79 | 77 |
80 bool handled = true; | 78 bool handled = true; |
81 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) | 79 IPC_BEGIN_MESSAGE_MAP(UtilityThreadImpl, msg) |
82 IPC_MESSAGE_HANDLER(UtilityMsg_IDBKeysFromValuesAndKeyPath, | |
83 OnIDBKeysFromValuesAndKeyPath) | |
84 IPC_MESSAGE_HANDLER(UtilityMsg_InjectIDBKey, OnInjectIDBKey) | |
85 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) | 80 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Started, OnBatchModeStarted) |
86 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) | 81 IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) |
87 #if defined(OS_POSIX) | 82 #if defined(OS_POSIX) |
88 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) | 83 IPC_MESSAGE_HANDLER(UtilityMsg_LoadPlugins, OnLoadPlugins) |
89 #endif // OS_POSIX | 84 #endif // OS_POSIX |
90 IPC_MESSAGE_UNHANDLED(handled = false) | 85 IPC_MESSAGE_UNHANDLED(handled = false) |
91 IPC_END_MESSAGE_MAP() | 86 IPC_END_MESSAGE_MAP() |
92 return handled; | 87 return handled; |
93 } | 88 } |
94 | 89 |
95 void UtilityThreadImpl::OnIDBKeysFromValuesAndKeyPath( | |
96 int id, | |
97 const std::vector<content::SerializedScriptValue>& serialized_script_values, | |
98 const content::IndexedDBKeyPath& idb_key_path) { | |
99 std::vector<WebKit::WebSerializedScriptValue> web_values; | |
100 ConvertVector(serialized_script_values, &web_values); | |
101 std::vector<WebKit::WebIDBKey> web_keys; | |
102 webkit_glue::IDBKeysFromValuesAndKeyPath( | |
103 web_values, idb_key_path, &web_keys); | |
104 std::vector<content::IndexedDBKey> keys; | |
105 ConvertVector(web_keys, &keys); | |
106 Send(new UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Succeeded(id, keys)); | |
107 ReleaseProcessIfNeeded(); | |
108 } | |
109 | |
110 void UtilityThreadImpl::OnInjectIDBKey( | |
111 const content::IndexedDBKey& key, | |
112 const content::SerializedScriptValue& value, | |
113 const content::IndexedDBKeyPath& key_path) { | |
114 content::SerializedScriptValue new_value( | |
115 webkit_glue::InjectIDBKey(key, value, key_path)); | |
116 Send(new UtilityHostMsg_InjectIDBKey_Finished(new_value)); | |
117 ReleaseProcessIfNeeded(); | |
118 } | |
119 | |
120 void UtilityThreadImpl::OnBatchModeStarted() { | 90 void UtilityThreadImpl::OnBatchModeStarted() { |
121 batch_mode_ = true; | 91 batch_mode_ = true; |
122 } | 92 } |
123 | 93 |
124 void UtilityThreadImpl::OnBatchModeFinished() { | 94 void UtilityThreadImpl::OnBatchModeFinished() { |
125 ChildProcess::current()->ReleaseProcess(); | 95 ChildProcess::current()->ReleaseProcess(); |
126 } | 96 } |
127 | 97 |
128 #if defined(OS_POSIX) | 98 #if defined(OS_POSIX) |
129 void UtilityThreadImpl::OnLoadPlugins( | 99 void UtilityThreadImpl::OnLoadPlugins( |
(...skipping 22 matching lines...) Expand all Loading... | |
152 webkit::WebPluginInfo plugin; | 122 webkit::WebPluginInfo plugin; |
153 if (!plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups, &plugin)) | 123 if (!plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups, &plugin)) |
154 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); | 124 Send(new UtilityHostMsg_LoadPluginFailed(i, plugin_paths[i])); |
155 else | 125 else |
156 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); | 126 Send(new UtilityHostMsg_LoadedPlugin(i, plugin)); |
157 } | 127 } |
158 | 128 |
159 ReleaseProcessIfNeeded(); | 129 ReleaseProcessIfNeeded(); |
160 } | 130 } |
161 #endif | 131 #endif |
OLD | NEW |