Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: chrome/renderer/render_thread.cc

Issue 155514: Implement extension specific events (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 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 <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 base::SharedMemoryHandle scripts) { 207 base::SharedMemoryHandle scripts) {
208 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; 208 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle";
209 user_script_slave_->UpdateScripts(scripts); 209 user_script_slave_->UpdateScripts(scripts);
210 } 210 }
211 211
212 void RenderThread::OnSetExtensionFunctionNames( 212 void RenderThread::OnSetExtensionFunctionNames(
213 const std::vector<std::string>& names) { 213 const std::vector<std::string>& names) {
214 ExtensionProcessBindings::SetFunctionNames(names); 214 ExtensionProcessBindings::SetFunctionNames(names);
215 } 215 }
216 216
217 void RenderThread::OnPageActionsUpdated(
218 const std::string& extension_id,
219 const std::vector<std::string>& page_actions) {
220 ExtensionProcessBindings::SetPageActions(extension_id, page_actions);
221 }
222
217 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { 223 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
218 // App cache messages are handled by a delegate. 224 // App cache messages are handled by a delegate.
219 if (app_cache_dispatcher_->OnMessageReceived(msg)) 225 if (app_cache_dispatcher_->OnMessageReceived(msg))
220 return; 226 return;
221 227
222 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) 228 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg)
223 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) 229 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks)
224 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) 230 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks)
225 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) 231 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks)
226 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) 232 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID)
227 // TODO(port): removed from render_messages_internal.h; 233 // TODO(port): removed from render_messages_internal.h;
228 // is there a new non-windows message I should add here? 234 // is there a new non-windows message I should add here?
229 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) 235 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView)
230 IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities) 236 IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities)
231 IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms, 237 IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms,
232 OnGetRendererHistograms) 238 OnGetRendererHistograms)
233 IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats, 239 IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats,
234 OnGetCacheResourceStats) 240 OnGetCacheResourceStats)
235 IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts, 241 IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts,
236 OnUpdateUserScripts) 242 OnUpdateUserScripts)
237 // TODO(rafaelw): create an ExtensionDispatcher that handles extension 243 // TODO(rafaelw): create an ExtensionDispatcher that handles extension
238 // messages seperates their handling from the RenderThread. 244 // messages seperates their handling from the RenderThread.
239 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, 245 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
240 OnExtensionMessageInvoke) 246 OnExtensionMessageInvoke)
241 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, 247 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames,
242 OnSetExtensionFunctionNames) 248 OnSetExtensionFunctionNames)
243 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, 249 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache,
244 OnPurgePluginListCache) 250 OnPurgePluginListCache)
251 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions,
252 OnPageActionsUpdated)
245 IPC_END_MESSAGE_MAP() 253 IPC_END_MESSAGE_MAP()
246 } 254 }
247 255
248 void RenderThread::OnSetNextPageID(int32 next_page_id) { 256 void RenderThread::OnSetNextPageID(int32 next_page_id) {
249 // This should only be called at process initialization time, so we shouldn't 257 // This should only be called at process initialization time, so we shouldn't
250 // have to worry about thread-safety. 258 // have to worry about thread-safety.
251 RenderView::SetNextPageID(next_page_id); 259 RenderView::SetNextPageID(next_page_id);
252 } 260 }
253 261
254 void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd, 262 void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 405
398 void RenderThread::OnPurgePluginListCache() { 406 void RenderThread::OnPurgePluginListCache() {
399 // The call below will cause a GetPlugins call with refresh=true, but at this 407 // The call below will cause a GetPlugins call with refresh=true, but at this
400 // point we already know that the browser has refreshed its list, so disable 408 // point we already know that the browser has refreshed its list, so disable
401 // refresh temporarily to prevent each renderer process causing the list to be 409 // refresh temporarily to prevent each renderer process causing the list to be
402 // regenerated. 410 // regenerated.
403 plugin_refresh_allowed_ = false; 411 plugin_refresh_allowed_ = false;
404 WebKit::resetPluginCache(); 412 WebKit::resetPluginCache();
405 plugin_refresh_allowed_ = true; 413 plugin_refresh_allowed_ = true;
406 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698