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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 #include "third_party/WebKit/public/web/WebDataSource.h" | 95 #include "third_party/WebKit/public/web/WebDataSource.h" |
96 #include "third_party/WebKit/public/web/WebDocument.h" | 96 #include "third_party/WebKit/public/web/WebDocument.h" |
97 #include "third_party/WebKit/public/web/WebFrame.h" | 97 #include "third_party/WebKit/public/web/WebFrame.h" |
98 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 98 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
99 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" | 99 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" |
100 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" | 100 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
101 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 101 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
102 #include "third_party/WebKit/public/web/WebView.h" | 102 #include "third_party/WebKit/public/web/WebView.h" |
103 #include "ui/base/layout.h" | 103 #include "ui/base/layout.h" |
104 #include "ui/base/resource/resource_bundle.h" | 104 #include "ui/base/resource/resource_bundle.h" |
| 105 #include "url/url_constants.h" |
105 #include "v8/include/v8.h" | 106 #include "v8/include/v8.h" |
106 | 107 |
107 #if defined(ENABLE_WEBRTC) | 108 #if defined(ENABLE_WEBRTC) |
108 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" | 109 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" |
109 #endif | 110 #endif |
110 | 111 |
111 using base::UserMetricsAction; | 112 using base::UserMetricsAction; |
112 using blink::WebDataSource; | 113 using blink::WebDataSource; |
113 using blink::WebDocument; | 114 using blink::WebDocument; |
114 using blink::WebFrame; | 115 using blink::WebFrame; |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 PermissionsData::GetEffectiveHostPermissions(extension)); | 1386 PermissionsData::GetEffectiveHostPermissions(extension)); |
1386 } | 1387 } |
1387 | 1388 |
1388 void Dispatcher::AddOrRemoveOriginPermissions( | 1389 void Dispatcher::AddOrRemoveOriginPermissions( |
1389 UpdatedExtensionPermissionsInfo::Reason reason, | 1390 UpdatedExtensionPermissionsInfo::Reason reason, |
1390 const Extension* extension, | 1391 const Extension* extension, |
1391 const URLPatternSet& origins) { | 1392 const URLPatternSet& origins) { |
1392 for (URLPatternSet::const_iterator i = origins.begin(); | 1393 for (URLPatternSet::const_iterator i = origins.begin(); |
1393 i != origins.end(); ++i) { | 1394 i != origins.end(); ++i) { |
1394 const char* schemes[] = { | 1395 const char* schemes[] = { |
1395 content::kHttpScheme, | 1396 url::kHttpScheme, |
1396 content::kHttpsScheme, | 1397 url::kHttpsScheme, |
1397 content::kFileScheme, | 1398 content::kFileScheme, |
1398 content::kChromeUIScheme, | 1399 content::kChromeUIScheme, |
1399 content::kFtpScheme, | 1400 content::kFtpScheme, |
1400 }; | 1401 }; |
1401 for (size_t j = 0; j < arraysize(schemes); ++j) { | 1402 for (size_t j = 0; j < arraysize(schemes); ++j) { |
1402 if (i->MatchesScheme(schemes[j])) { | 1403 if (i->MatchesScheme(schemes[j])) { |
1403 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ? | 1404 ((reason == UpdatedExtensionPermissionsInfo::REMOVED) ? |
1404 WebSecurityPolicy::removeOriginAccessWhitelistEntry : | 1405 WebSecurityPolicy::removeOriginAccessWhitelistEntry : |
1405 WebSecurityPolicy::addOriginAccessWhitelistEntry)( | 1406 WebSecurityPolicy::addOriginAccessWhitelistEntry)( |
1406 extension->url(), | 1407 extension->url(), |
1407 WebString::fromUTF8(schemes[j]), | 1408 WebString::fromUTF8(schemes[j]), |
1408 WebString::fromUTF8(i->host()), | 1409 WebString::fromUTF8(i->host()), |
1409 i->match_subdomains()); | 1410 i->match_subdomains()); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 } | 1706 } |
1706 | 1707 |
1707 void Dispatcher::ClearPortData(int port_id) { | 1708 void Dispatcher::ClearPortData(int port_id) { |
1708 // Only the target port side has entries in |port_to_tab_id_map_|. If | 1709 // Only the target port side has entries in |port_to_tab_id_map_|. If |
1709 // |port_id| is a source port, std::map::erase() will just silently fail | 1710 // |port_id| is a source port, std::map::erase() will just silently fail |
1710 // here as a no-op. | 1711 // here as a no-op. |
1711 port_to_tab_id_map_.erase(port_id); | 1712 port_to_tab_id_map_.erase(port_id); |
1712 } | 1713 } |
1713 | 1714 |
1714 } // namespace extensions | 1715 } // namespace extensions |
OLD | NEW |