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

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

Issue 15836003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 (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 "chrome/renderer/extensions/dispatcher.h" 5 #include "chrome/renderer/extensions/dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 port_id, error_message, 610 port_id, error_message,
611 NULL); // All render views. 611 NULL); // All render views.
612 } 612 }
613 613
614 void Dispatcher::OnLoaded( 614 void Dispatcher::OnLoaded(
615 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions) { 615 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions) {
616 std::vector<ExtensionMsg_Loaded_Params>::const_iterator i; 616 std::vector<ExtensionMsg_Loaded_Params>::const_iterator i;
617 for (i = loaded_extensions.begin(); i != loaded_extensions.end(); ++i) { 617 for (i = loaded_extensions.begin(); i != loaded_extensions.end(); ++i) {
618 std::string error; 618 std::string error;
619 scoped_refptr<const Extension> extension = i->ConvertToExtension(&error); 619 scoped_refptr<const Extension> extension = i->ConvertToExtension(&error);
620 if (!extension) { 620 if (!extension.get()) {
621 extension_load_errors_[i->id] = error; 621 extension_load_errors_[i->id] = error;
622 continue; 622 continue;
623 } 623 }
624 OnLoadedInternal(extension); 624 OnLoadedInternal(extension);
625 } 625 }
626 } 626 }
627 627
628 void Dispatcher::OnLoadedInternal(scoped_refptr<const Extension> extension) { 628 void Dispatcher::OnLoadedInternal(scoped_refptr<const Extension> extension) {
629 extensions_.Insert(extension); 629 extensions_.Insert(extension);
630 } 630 }
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 scoped_refptr<const PermissionSet> delta = 1265 scoped_refptr<const PermissionSet> delta =
1266 new PermissionSet(apis, explicit_hosts, scriptable_hosts); 1266 new PermissionSet(apis, explicit_hosts, scriptable_hosts);
1267 scoped_refptr<const PermissionSet> old_active = 1267 scoped_refptr<const PermissionSet> old_active =
1268 extension->GetActivePermissions(); 1268 extension->GetActivePermissions();
1269 UpdatedExtensionPermissionsInfo::Reason reason = 1269 UpdatedExtensionPermissionsInfo::Reason reason =
1270 static_cast<UpdatedExtensionPermissionsInfo::Reason>(reason_id); 1270 static_cast<UpdatedExtensionPermissionsInfo::Reason>(reason_id);
1271 1271
1272 const PermissionSet* new_active = NULL; 1272 const PermissionSet* new_active = NULL;
1273 switch (reason) { 1273 switch (reason) {
1274 case UpdatedExtensionPermissionsInfo::ADDED: 1274 case UpdatedExtensionPermissionsInfo::ADDED:
1275 new_active = PermissionSet::CreateUnion(old_active, delta); 1275 new_active = PermissionSet::CreateUnion(old_active.get(), delta.get());
1276 break; 1276 break;
1277 case UpdatedExtensionPermissionsInfo::REMOVED: 1277 case UpdatedExtensionPermissionsInfo::REMOVED:
1278 new_active = PermissionSet::CreateDifference(old_active, delta); 1278 new_active =
1279 PermissionSet::CreateDifference(old_active.get(), delta.get());
1279 break; 1280 break;
1280 } 1281 }
1281 1282
1282 PermissionsData::SetActivePermissions(extension, new_active); 1283 PermissionsData::SetActivePermissions(extension, new_active);
1283 AddOrRemoveOriginPermissions(reason, extension, explicit_hosts); 1284 AddOrRemoveOriginPermissions(reason, extension, explicit_hosts);
1284 } 1285 }
1285 1286
1286 void Dispatcher::OnUpdateTabSpecificPermissions( 1287 void Dispatcher::OnUpdateTabSpecificPermissions(
1287 int page_id, 1288 int page_id,
1288 int tab_id, 1289 int tab_id,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 1459 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
1459 v8::ThrowException( 1460 v8::ThrowException(
1460 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 1461 v8::Exception::Error(v8::String::New(error_msg.c_str())));
1461 return false; 1462 return false;
1462 } 1463 }
1463 1464
1464 return true; 1465 return true;
1465 } 1466 }
1466 1467
1467 } // namespace extensions 1468 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698