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

Side by Side Diff: chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.cc

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 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 "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" 5 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void ChromeExtensionsDispatcherDelegate::ClearTabSpecificPermissions( 328 void ChromeExtensionsDispatcherDelegate::ClearTabSpecificPermissions(
329 const extensions::Dispatcher* dispatcher, 329 const extensions::Dispatcher* dispatcher,
330 int tab_id, 330 int tab_id,
331 const std::vector<std::string>& extension_ids) { 331 const std::vector<std::string>& extension_ids) {
332 for (std::vector<std::string>::const_iterator it = extension_ids.begin(); 332 for (std::vector<std::string>::const_iterator it = extension_ids.begin();
333 it != extension_ids.end(); 333 it != extension_ids.end();
334 ++it) { 334 ++it) {
335 const extensions::Extension* extension = 335 const extensions::Extension* extension =
336 dispatcher->extensions()->GetByID(*it); 336 dispatcher->extensions()->GetByID(*it);
337 if (extension) 337 if (extension)
338 extensions::PermissionsData::ForExtension(extension) 338 extension->permissions_data()->ClearTabSpecificPermissions(tab_id);
339 ->ClearTabSpecificPermissions(tab_id);
340 } 339 }
341 } 340 }
342 341
343 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions( 342 void ChromeExtensionsDispatcherDelegate::UpdateTabSpecificPermissions(
344 const extensions::Dispatcher* dispatcher, 343 const extensions::Dispatcher* dispatcher,
345 int page_id, 344 int page_id,
346 int tab_id, 345 int tab_id,
347 const std::string& extension_id, 346 const std::string& extension_id,
348 const extensions::URLPatternSet& origin_set) { 347 const extensions::URLPatternSet& origin_set) {
349 content::RenderView* view = extensions::TabFinder::Find(tab_id); 348 content::RenderView* view = extensions::TabFinder::Find(tab_id);
350 349
351 // For now, the message should only be sent to the render view that contains 350 // For now, the message should only be sent to the render view that contains
352 // the target tab. This may change. Either way, if this is the target tab it 351 // the target tab. This may change. Either way, if this is the target tab it
353 // gives us the chance to check against the page ID to avoid races. 352 // gives us the chance to check against the page ID to avoid races.
354 DCHECK(view); 353 DCHECK(view);
355 if (view && view->GetPageId() != page_id) 354 if (view && view->GetPageId() != page_id)
356 return; 355 return;
357 356
358 const extensions::Extension* extension = 357 const extensions::Extension* extension =
359 dispatcher->extensions()->GetByID(extension_id); 358 dispatcher->extensions()->GetByID(extension_id);
360 if (!extension) 359 if (!extension)
361 return; 360 return;
362 361
363 extensions::PermissionsData::ForExtension(extension) 362 extension->permissions_data()->UpdateTabSpecificPermissions(
364 ->UpdateTabSpecificPermissions( 363 tab_id,
365 tab_id, 364 new extensions::PermissionSet(extensions::APIPermissionSet(),
366 new extensions::PermissionSet(extensions::APIPermissionSet(), 365 extensions::ManifestPermissionSet(),
367 extensions::ManifestPermissionSet(), 366 origin_set,
368 origin_set, 367 extensions::URLPatternSet()));
369 extensions::URLPatternSet()));
370 } 368 }
371 369
372 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage( 370 void ChromeExtensionsDispatcherDelegate::HandleWebRequestAPIUsage(
373 bool adblock, 371 bool adblock,
374 bool adblock_plus, 372 bool adblock_plus,
375 bool other) { 373 bool other) {
376 webrequest_adblock_ = adblock; 374 webrequest_adblock_ = adblock;
377 webrequest_adblock_plus_ = adblock_plus; 375 webrequest_adblock_plus_ = adblock_plus;
378 webrequest_other_ = other; 376 webrequest_other_ = other;
379 } 377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698