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/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 // Temporarily allow these whitelisted apps and WebUIs to use NaCl. | 1000 // Temporarily allow these whitelisted apps and WebUIs to use NaCl. |
1001 std::string app_url_host = app_url.host(); | 1001 std::string app_url_host = app_url.host(); |
1002 std::string manifest_url_path = manifest_url.path(); | 1002 std::string manifest_url_path = manifest_url.path(); |
1003 | 1003 |
1004 bool is_whitelisted_web_ui = | 1004 bool is_whitelisted_web_ui = |
1005 app_url.spec() == chrome::kChromeUIAppListStartPageURL; | 1005 app_url.spec() == chrome::kChromeUIAppListStartPageURL; |
1006 | 1006 |
1007 bool is_photo_app = | 1007 bool is_photo_app = |
1008 // Whitelisted apps must be served over https. | 1008 // Whitelisted apps must be served over https. |
1009 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() && | 1009 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() && |
1010 (base::EndsWith(app_url_host, "plus.google.com", false) || | 1010 (base::EndsWith(app_url_host, "plus.google.com", |
1011 base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) && | 1011 base::CompareCase::INSENSITIVE_ASCII) || |
| 1012 base::EndsWith(app_url_host, "plus.sandbox.google.com", |
| 1013 base::CompareCase::INSENSITIVE_ASCII)) && |
1012 manifest_url.DomainIs("ssl.gstatic.com") && | 1014 manifest_url.DomainIs("ssl.gstatic.com") && |
1013 (manifest_url_path.find("s2/oz/nacl/") == 1 || | 1015 (manifest_url_path.find("s2/oz/nacl/") == 1 || |
1014 manifest_url_path.find("photos/nacl/") == 1); | 1016 manifest_url_path.find("photos/nacl/") == 1); |
1015 | 1017 |
1016 std::string manifest_fs_host; | 1018 std::string manifest_fs_host; |
1017 if (manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()) { | 1019 if (manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()) { |
1018 manifest_fs_host = manifest_url.inner_url()->host(); | 1020 manifest_fs_host = manifest_url.inner_url()->host(); |
1019 } | 1021 } |
1020 bool is_hangouts_app = | 1022 bool is_hangouts_app = |
1021 // Whitelisted apps must be served over secure scheme. | 1023 // Whitelisted apps must be served over secure scheme. |
1022 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() && | 1024 app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() && |
1023 manifest_url.inner_url()->SchemeIsCryptographic() && | 1025 manifest_url.inner_url()->SchemeIsCryptographic() && |
1024 (base::EndsWith(app_url_host, "talkgadget.google.com", false) || | 1026 (base::EndsWith(app_url_host, "talkgadget.google.com", |
1025 base::EndsWith(app_url_host, "plus.google.com", false) || | 1027 base::CompareCase::INSENSITIVE_ASCII) || |
1026 base::EndsWith(app_url_host, "plus.sandbox.google.com", false)) && | 1028 base::EndsWith(app_url_host, "plus.google.com", |
| 1029 base::CompareCase::INSENSITIVE_ASCII) || |
| 1030 base::EndsWith(app_url_host, "plus.sandbox.google.com", |
| 1031 base::CompareCase::INSENSITIVE_ASCII)) && |
1027 // The manifest must be loaded from the host's FileSystem. | 1032 // The manifest must be loaded from the host's FileSystem. |
1028 (manifest_fs_host == app_url_host); | 1033 (manifest_fs_host == app_url_host); |
1029 | 1034 |
1030 bool is_whitelisted_app = is_photo_app || is_hangouts_app; | 1035 bool is_whitelisted_app = is_photo_app || is_hangouts_app; |
1031 | 1036 |
1032 bool is_invoked_by_webstore_installed_extension = false; | 1037 bool is_invoked_by_webstore_installed_extension = false; |
1033 bool is_extension_unrestricted = false; | 1038 bool is_extension_unrestricted = false; |
1034 bool is_extension_force_installed = false; | 1039 bool is_extension_force_installed = false; |
1035 #if defined(ENABLE_EXTENSIONS) | 1040 #if defined(ENABLE_EXTENSIONS) |
1036 bool is_extension_from_webstore = extension && extension->from_webstore(); | 1041 bool is_extension_from_webstore = extension && extension->from_webstore(); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 WebString header_key(ASCIIToUTF16( | 1617 WebString header_key(ASCIIToUTF16( |
1613 data_reduction_proxy::chrome_proxy_header())); | 1618 data_reduction_proxy::chrome_proxy_header())); |
1614 if (!response.httpHeaderField(header_key).isNull() && | 1619 if (!response.httpHeaderField(header_key).isNull() && |
1615 response.httpHeaderField(header_key).utf8().find( | 1620 response.httpHeaderField(header_key).utf8().find( |
1616 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != | 1621 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != |
1617 std::string::npos) { | 1622 std::string::npos) { |
1618 (*properties)[data_reduction_proxy::chrome_proxy_header()] = | 1623 (*properties)[data_reduction_proxy::chrome_proxy_header()] = |
1619 data_reduction_proxy::chrome_proxy_lo_fi_directive(); | 1624 data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
1620 } | 1625 } |
1621 } | 1626 } |
OLD | NEW |