OLD | NEW |
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/user_script_slave.h" | 5 #include "chrome/renderer/extensions/user_script_slave.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 // static | 99 // static |
100 void UserScriptSlave::InitializeIsolatedWorld(int isolated_world_id, | 100 void UserScriptSlave::InitializeIsolatedWorld(int isolated_world_id, |
101 const Extension* extension) { | 101 const Extension* extension) { |
102 const URLPatternSet& permissions = | 102 const URLPatternSet& permissions = |
103 PermissionsData::GetEffectiveHostPermissions(extension); | 103 PermissionsData::GetEffectiveHostPermissions(extension); |
104 for (URLPatternSet::const_iterator i = permissions.begin(); | 104 for (URLPatternSet::const_iterator i = permissions.begin(); |
105 i != permissions.end(); ++i) { | 105 i != permissions.end(); ++i) { |
106 const char* schemes[] = { | 106 const char* schemes[] = { |
107 chrome::kHttpScheme, | 107 content::kHttpScheme, |
108 content::kHttpsScheme, | 108 content::kHttpsScheme, |
109 chrome::kFileScheme, | 109 chrome::kFileScheme, |
110 chrome::kChromeUIScheme, | 110 chrome::kChromeUIScheme, |
111 }; | 111 }; |
112 for (size_t j = 0; j < arraysize(schemes); ++j) { | 112 for (size_t j = 0; j < arraysize(schemes); ++j) { |
113 if (i->MatchesScheme(schemes[j])) { | 113 if (i->MatchesScheme(schemes[j])) { |
114 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 114 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
115 extension->url(), | 115 extension->url(), |
116 WebString::fromUTF8(schemes[j]), | 116 WebString::fromUTF8(schemes[j]), |
117 WebString::fromUTF8(i->host()), | 117 WebString::fromUTF8(i->host()), |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } else if (location == UserScript::DOCUMENT_IDLE) { | 377 } else if (location == UserScript::DOCUMENT_IDLE) { |
378 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 378 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
379 if (num_scripts) | 379 if (num_scripts) |
380 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 380 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
381 } else { | 381 } else { |
382 NOTREACHED(); | 382 NOTREACHED(); |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 } // namespace extensions | 386 } // namespace extensions |
OLD | NEW |