| 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/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #include "extensions/renderer/render_view_observer_natives.h" | 80 #include "extensions/renderer/render_view_observer_natives.h" |
| 81 #include "extensions/renderer/request_sender.h" | 81 #include "extensions/renderer/request_sender.h" |
| 82 #include "extensions/renderer/safe_builtins.h" | 82 #include "extensions/renderer/safe_builtins.h" |
| 83 #include "extensions/renderer/script_context.h" | 83 #include "extensions/renderer/script_context.h" |
| 84 #include "extensions/renderer/script_context_set.h" | 84 #include "extensions/renderer/script_context_set.h" |
| 85 #include "extensions/renderer/send_request_natives.h" | 85 #include "extensions/renderer/send_request_natives.h" |
| 86 #include "extensions/renderer/set_icon_natives.h" | 86 #include "extensions/renderer/set_icon_natives.h" |
| 87 #include "extensions/renderer/utils_native_handler.h" | 87 #include "extensions/renderer/utils_native_handler.h" |
| 88 #include "grit/common_resources.h" | 88 #include "grit/common_resources.h" |
| 89 #include "grit/renderer_resources.h" | 89 #include "grit/renderer_resources.h" |
| 90 #include "net/base/url_constants.h" |
| 90 #include "third_party/WebKit/public/platform/WebString.h" | 91 #include "third_party/WebKit/public/platform/WebString.h" |
| 91 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 92 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 92 #include "third_party/WebKit/public/web/WebCustomElement.h" | 93 #include "third_party/WebKit/public/web/WebCustomElement.h" |
| 93 #include "third_party/WebKit/public/web/WebDataSource.h" | 94 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 94 #include "third_party/WebKit/public/web/WebDocument.h" | 95 #include "third_party/WebKit/public/web/WebDocument.h" |
| 95 #include "third_party/WebKit/public/web/WebFrame.h" | 96 #include "third_party/WebKit/public/web/WebFrame.h" |
| 96 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 97 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 97 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 98 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
| 98 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 99 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| 99 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 100 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 PermissionsData::GetEffectiveHostPermissions(extension)); | 1384 PermissionsData::GetEffectiveHostPermissions(extension)); |
| 1384 } | 1385 } |
| 1385 | 1386 |
| 1386 void Dispatcher::AddOrRemoveOriginPermissions( | 1387 void Dispatcher::AddOrRemoveOriginPermissions( |
| 1387 UpdatedExtensionPermissionsInfo::Reason reason, | 1388 UpdatedExtensionPermissionsInfo::Reason reason, |
| 1388 const Extension* extension, | 1389 const Extension* extension, |
| 1389 const URLPatternSet& origins) { | 1390 const URLPatternSet& origins) { |
| 1390 for (URLPatternSet::const_iterator i = origins.begin(); | 1391 for (URLPatternSet::const_iterator i = origins.begin(); |
| 1391 i != origins.end(); ++i) { | 1392 i != origins.end(); ++i) { |
| 1392 const char* schemes[] = { | 1393 const char* schemes[] = { |
| 1393 content::kHttpScheme, | 1394 net::kHttpScheme, net::kHttpsScheme, content::kFileScheme, |
| 1394 content::kHttpsScheme, | 1395 content::kChromeUIScheme, content::kFtpScheme, |
| 1395 content::kFileScheme, | |
| 1396 content::kChromeUIScheme, | |
| 1397 content::kFtpScheme, | |
| 1398 }; | 1396 }; |
| 1399 for (size_t j = 0; j < arraysize(schemes); ++j) { | 1397 for (size_t j = 0; j < arraysize(schemes); ++j) { |
| 1400 if (i->MatchesScheme(schemes[j])) { | 1398 if (i->MatchesScheme(schemes[j])) { |
| 1401 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ? | 1399 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ? |
| 1402 WebSecurityPolicy::removeOriginAccessWhitelistEntry : | 1400 WebSecurityPolicy::removeOriginAccessWhitelistEntry : |
| 1403 WebSecurityPolicy::addOriginAccessWhitelistEntry)( | 1401 WebSecurityPolicy::addOriginAccessWhitelistEntry)( |
| 1404 extension->url(), | 1402 extension->url(), |
| 1405 WebString::fromUTF8(schemes[j]), | 1403 WebString::fromUTF8(schemes[j]), |
| 1406 WebString::fromUTF8(i->host()), | 1404 WebString::fromUTF8(i->host()), |
| 1407 i->match_subdomains()); | 1405 i->match_subdomains()); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 } | 1701 } |
| 1704 | 1702 |
| 1705 void Dispatcher::ClearPortData(int port_id) { | 1703 void Dispatcher::ClearPortData(int port_id) { |
| 1706 // Only the target port side has entries in |port_to_tab_id_map_|. If | 1704 // Only the target port side has entries in |port_to_tab_id_map_|. If |
| 1707 // |port_id| is a source port, std::map::erase() will just silently fail | 1705 // |port_id| is a source port, std::map::erase() will just silently fail |
| 1708 // here as a no-op. | 1706 // here as a no-op. |
| 1709 port_to_tab_id_map_.erase(port_id); | 1707 port_to_tab_id_map_.erase(port_id); |
| 1710 } | 1708 } |
| 1711 | 1709 |
| 1712 } // namespace extensions | 1710 } // namespace extensions |
| OLD | NEW |