OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/shared_memory.h" | 14 #include "base/shared_memory.h" |
14 #include "base/stats_table.h" | 15 #include "base/stats_table.h" |
15 #include "base/thread_local.h" | 16 #include "base/thread_local.h" |
16 #include "chrome/common/appcache/appcache_dispatcher.h" | 17 #include "chrome/common/appcache/appcache_dispatcher.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 const std::string& extension_id, | 232 const std::string& extension_id, |
232 const std::vector<std::string>& permissions) { | 233 const std::vector<std::string>& permissions) { |
233 ExtensionProcessBindings::SetAPIPermissions(extension_id, permissions); | 234 ExtensionProcessBindings::SetAPIPermissions(extension_id, permissions); |
234 } | 235 } |
235 | 236 |
236 void RenderThread::OnExtensionSetHostPermissions( | 237 void RenderThread::OnExtensionSetHostPermissions( |
237 const GURL& extension_url, const std::vector<URLPattern>& permissions) { | 238 const GURL& extension_url, const std::vector<URLPattern>& permissions) { |
238 ExtensionProcessBindings::SetHostPermissions(extension_url, permissions); | 239 ExtensionProcessBindings::SetHostPermissions(extension_url, permissions); |
239 } | 240 } |
240 | 241 |
| 242 void RenderThread::OnExtensionSetL10nMessages( |
| 243 const std::string& extension_id, |
| 244 const std::map<std::string, std::string>& l10n_messages) { |
| 245 ExtensionProcessBindings::SetL10nMessages(extension_id, l10n_messages); |
| 246 } |
| 247 |
241 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { | 248 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { |
242 // App cache messages are handled by a delegate. | 249 // App cache messages are handled by a delegate. |
243 if (appcache_dispatcher_->OnMessageReceived(msg)) | 250 if (appcache_dispatcher_->OnMessageReceived(msg)) |
244 return; | 251 return; |
245 | 252 |
246 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) | 253 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) |
247 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) | 254 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) |
248 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) | 255 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) |
249 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) | 256 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) |
250 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) | 257 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) |
(...skipping 15 matching lines...) Expand all Loading... |
266 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, | 273 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, |
267 OnSetExtensionFunctionNames) | 274 OnSetExtensionFunctionNames) |
268 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, | 275 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, |
269 OnPurgePluginListCache) | 276 OnPurgePluginListCache) |
270 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions, | 277 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions, |
271 OnPageActionsUpdated) | 278 OnPageActionsUpdated) |
272 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions, | 279 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions, |
273 OnExtensionSetAPIPermissions) | 280 OnExtensionSetAPIPermissions) |
274 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions, | 281 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions, |
275 OnExtensionSetHostPermissions) | 282 OnExtensionSetHostPermissions) |
| 283 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetL10nMessages, |
| 284 OnExtensionSetL10nMessages) |
276 IPC_END_MESSAGE_MAP() | 285 IPC_END_MESSAGE_MAP() |
277 } | 286 } |
278 | 287 |
279 void RenderThread::OnSetNextPageID(int32 next_page_id) { | 288 void RenderThread::OnSetNextPageID(int32 next_page_id) { |
280 // This should only be called at process initialization time, so we shouldn't | 289 // This should only be called at process initialization time, so we shouldn't |
281 // have to worry about thread-safety. | 290 // have to worry about thread-safety. |
282 RenderView::SetNextPageID(next_page_id); | 291 RenderView::SetNextPageID(next_page_id); |
283 } | 292 } |
284 | 293 |
285 // Called when to register CSS Color name->system color mappings. | 294 // Called when to register CSS Color name->system color mappings. |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 501 |
493 void RenderThread::OnPurgePluginListCache(bool reload_pages) { | 502 void RenderThread::OnPurgePluginListCache(bool reload_pages) { |
494 // The call below will cause a GetPlugins call with refresh=true, but at this | 503 // The call below will cause a GetPlugins call with refresh=true, but at this |
495 // point we already know that the browser has refreshed its list, so disable | 504 // point we already know that the browser has refreshed its list, so disable |
496 // refresh temporarily to prevent each renderer process causing the list to be | 505 // refresh temporarily to prevent each renderer process causing the list to be |
497 // regenerated. | 506 // regenerated. |
498 plugin_refresh_allowed_ = false; | 507 plugin_refresh_allowed_ = false; |
499 WebKit::resetPluginCache(reload_pages); | 508 WebKit::resetPluginCache(reload_pages); |
500 plugin_refresh_allowed_ = true; | 509 plugin_refresh_allowed_ = true; |
501 } | 510 } |
OLD | NEW |