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

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

Issue 173166: Implement granular cross-origin XHR for extensions. (Closed)
Patch Set: some cleanup Created 11 years, 4 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
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 const std::vector<std::string>& names) { 195 const std::vector<std::string>& names) {
196 ExtensionProcessBindings::SetFunctionNames(names); 196 ExtensionProcessBindings::SetFunctionNames(names);
197 } 197 }
198 198
199 void RenderThread::OnPageActionsUpdated( 199 void RenderThread::OnPageActionsUpdated(
200 const std::string& extension_id, 200 const std::string& extension_id,
201 const std::vector<std::string>& page_actions) { 201 const std::vector<std::string>& page_actions) {
202 ExtensionProcessBindings::SetPageActions(extension_id, page_actions); 202 ExtensionProcessBindings::SetPageActions(extension_id, page_actions);
203 } 203 }
204 204
205 void RenderThread::OnExtensionSetPermissions( 205 void RenderThread::OnExtensionSetAPIPermissions(
206 const std::string& extension_id, 206 const std::string& extension_id,
207 const std::vector<std::string>& permissions) { 207 const std::vector<std::string>& permissions) {
208 ExtensionProcessBindings::SetPermissions(extension_id, permissions); 208 ExtensionProcessBindings::SetAPIPermissions(extension_id, permissions);
209 }
210
211 void RenderThread::OnExtensionSetHostPermissions(
212 const GURL& extension_url, const std::vector<URLPattern>& permissions) {
213 ExtensionProcessBindings::SetHostPermissions(extension_url, permissions);
209 } 214 }
210 215
211 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { 216 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
212 // App cache messages are handled by a delegate. 217 // App cache messages are handled by a delegate.
213 if (app_cache_dispatcher_->OnMessageReceived(msg)) 218 if (app_cache_dispatcher_->OnMessageReceived(msg))
214 return; 219 return;
215 220
216 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) 221 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg)
217 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) 222 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks)
218 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) 223 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks)
(...skipping 13 matching lines...) Expand all
232 // TODO(rafaelw): create an ExtensionDispatcher that handles extension 237 // TODO(rafaelw): create an ExtensionDispatcher that handles extension
233 // messages seperates their handling from the RenderThread. 238 // messages seperates their handling from the RenderThread.
234 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, 239 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
235 OnExtensionMessageInvoke) 240 OnExtensionMessageInvoke)
236 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, 241 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames,
237 OnSetExtensionFunctionNames) 242 OnSetExtensionFunctionNames)
238 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, 243 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache,
239 OnPurgePluginListCache) 244 OnPurgePluginListCache)
240 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions, 245 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions,
241 OnPageActionsUpdated) 246 OnPageActionsUpdated)
242 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetPermissions, 247 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions,
243 OnExtensionSetPermissions) 248 OnExtensionSetAPIPermissions)
249 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions,
250 OnExtensionSetHostPermissions)
244 IPC_END_MESSAGE_MAP() 251 IPC_END_MESSAGE_MAP()
245 } 252 }
246 253
247 void RenderThread::OnSetNextPageID(int32 next_page_id) { 254 void RenderThread::OnSetNextPageID(int32 next_page_id) {
248 // This should only be called at process initialization time, so we shouldn't 255 // This should only be called at process initialization time, so we shouldn't
249 // have to worry about thread-safety. 256 // have to worry about thread-safety.
250 RenderView::SetNextPageID(next_page_id); 257 RenderView::SetNextPageID(next_page_id);
251 } 258 }
252 259
253 // Called when to register CSS Color name->system color mappings. 260 // Called when to register CSS Color name->system color mappings.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 437
431 void RenderThread::OnPurgePluginListCache() { 438 void RenderThread::OnPurgePluginListCache() {
432 // The call below will cause a GetPlugins call with refresh=true, but at this 439 // The call below will cause a GetPlugins call with refresh=true, but at this
433 // point we already know that the browser has refreshed its list, so disable 440 // point we already know that the browser has refreshed its list, so disable
434 // refresh temporarily to prevent each renderer process causing the list to be 441 // refresh temporarily to prevent each renderer process causing the list to be
435 // regenerated. 442 // regenerated.
436 plugin_refresh_allowed_ = false; 443 plugin_refresh_allowed_ = false;
437 WebKit::resetPluginCache(); 444 WebKit::resetPluginCache();
438 plugin_refresh_allowed_ = true; 445 plugin_refresh_allowed_ = true;
439 } 446 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698