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

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

Issue 149643010: Cleanup: Move kChromeUIScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 } 1348 }
1349 } 1349 }
1350 1350
1351 void Dispatcher::InitOriginPermissions(const Extension* extension) { 1351 void Dispatcher::InitOriginPermissions(const Extension* extension) {
1352 // TODO(jstritar): We should try to remove this special case. Also, these 1352 // TODO(jstritar): We should try to remove this special case. Also, these
1353 // whitelist entries need to be updated when the kManagement permission 1353 // whitelist entries need to be updated when the kManagement permission
1354 // changes. 1354 // changes.
1355 if (extension->HasAPIPermission(APIPermission::kManagement)) { 1355 if (extension->HasAPIPermission(APIPermission::kManagement)) {
1356 WebSecurityPolicy::addOriginAccessWhitelistEntry( 1356 WebSecurityPolicy::addOriginAccessWhitelistEntry(
1357 extension->url(), 1357 extension->url(),
1358 WebString::fromUTF8(chrome::kChromeUIScheme), 1358 WebString::fromUTF8(content::kChromeUIScheme),
1359 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), 1359 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost),
1360 false); 1360 false);
1361 } 1361 }
1362 1362
1363 AddOrRemoveOriginPermissions( 1363 AddOrRemoveOriginPermissions(
1364 UpdatedExtensionPermissionsInfo::ADDED, 1364 UpdatedExtensionPermissionsInfo::ADDED,
1365 extension, 1365 extension,
1366 extension->GetActivePermissions()->explicit_hosts()); 1366 extension->GetActivePermissions()->explicit_hosts());
1367 } 1367 }
1368 1368
1369 void Dispatcher::AddOrRemoveOriginPermissions( 1369 void Dispatcher::AddOrRemoveOriginPermissions(
1370 UpdatedExtensionPermissionsInfo::Reason reason, 1370 UpdatedExtensionPermissionsInfo::Reason reason,
1371 const Extension* extension, 1371 const Extension* extension,
1372 const URLPatternSet& origins) { 1372 const URLPatternSet& origins) {
1373 for (URLPatternSet::const_iterator i = origins.begin(); 1373 for (URLPatternSet::const_iterator i = origins.begin();
1374 i != origins.end(); ++i) { 1374 i != origins.end(); ++i) {
1375 const char* schemes[] = { 1375 const char* schemes[] = {
1376 content::kHttpScheme, 1376 content::kHttpScheme,
1377 content::kHttpsScheme, 1377 content::kHttpsScheme,
1378 content::kFileScheme, 1378 content::kFileScheme,
1379 chrome::kChromeUIScheme, 1379 content::kChromeUIScheme,
1380 }; 1380 };
1381 for (size_t j = 0; j < arraysize(schemes); ++j) { 1381 for (size_t j = 0; j < arraysize(schemes); ++j) {
1382 if (i->MatchesScheme(schemes[j])) { 1382 if (i->MatchesScheme(schemes[j])) {
1383 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ? 1383 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ?
1384 WebSecurityPolicy::removeOriginAccessWhitelistEntry : 1384 WebSecurityPolicy::removeOriginAccessWhitelistEntry :
1385 WebSecurityPolicy::addOriginAccessWhitelistEntry)( 1385 WebSecurityPolicy::addOriginAccessWhitelistEntry)(
1386 extension->url(), 1386 extension->url(),
1387 WebString::fromUTF8(schemes[j]), 1387 WebString::fromUTF8(schemes[j]),
1388 WebString::fromUTF8(i->host()), 1388 WebString::fromUTF8(i->host()),
1389 i->match_subdomains()); 1389 i->match_subdomains());
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 } 1686 }
1687 1687
1688 void Dispatcher::ClearPortData(int port_id) { 1688 void Dispatcher::ClearPortData(int port_id) {
1689 // Only the target port side has entries in |port_to_tab_id_map_|. If 1689 // Only the target port side has entries in |port_to_tab_id_map_|. If
1690 // |port_id| is a source port, std::map::erase() will just silently fail 1690 // |port_id| is a source port, std::map::erase() will just silently fail
1691 // here as a no-op. 1691 // here as a no-op.
1692 port_to_tab_id_map_.erase(port_id); 1692 port_to_tab_id_map_.erase(port_id);
1693 } 1693 }
1694 1694
1695 } // namespace extensions 1695 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer_unittest.cc ('k') | chrome/renderer/extensions/user_script_slave.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698