| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_categorizer.h" | 5 #include "chrome/renderer/app_categorizer.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 kPredefinedHangoutsDomains, | 48 kPredefinedHangoutsDomains, |
| 49 arraysize(kPredefinedHangoutsDomains)); | 49 arraysize(kPredefinedHangoutsDomains)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool AppCategorizer::IsWhitelistedApp( | 52 bool AppCategorizer::IsWhitelistedApp( |
| 53 const GURL& manifest_url, const GURL& app_url) { | 53 const GURL& manifest_url, const GURL& app_url) { |
| 54 // Whitelisted apps must be served over https. | 54 // Whitelisted apps must be served over https. |
| 55 if (!app_url.SchemeIsCryptographic()) | 55 if (!app_url.SchemeIsCryptographic()) |
| 56 return false; | 56 return false; |
| 57 | 57 |
| 58 std::string manifest_url_path = manifest_url.path(); | 58 base::StringPiece manifest_url_path = manifest_url.path(); |
| 59 bool is_photo_app = | 59 bool is_photo_app = |
| 60 manifest_url.SchemeIsCryptographic() && | 60 manifest_url.SchemeIsCryptographic() && |
| 61 manifest_url.DomainIs("ssl.gstatic.com") && | 61 manifest_url.DomainIs("ssl.gstatic.com") && |
| 62 (base::StartsWith(manifest_url_path, "/s2/oz/nacl/", | 62 (base::StartsWith(manifest_url_path, "/s2/oz/nacl/", |
| 63 base::CompareCase::SENSITIVE) || | 63 base::CompareCase::SENSITIVE) || |
| 64 base::StartsWith(manifest_url_path, "/photos/nacl/", | 64 base::StartsWith(manifest_url_path, "/photos/nacl/", |
| 65 base::CompareCase::SENSITIVE)) && | 65 base::CompareCase::SENSITIVE)) && |
| 66 IsInWhitelistedDomain( | 66 IsInWhitelistedDomain( |
| 67 app_url, | 67 app_url, |
| 68 kPredefinedPlusDomains, | 68 kPredefinedPlusDomains, |
| 69 arraysize(kPredefinedPlusDomains)); | 69 arraysize(kPredefinedPlusDomains)); |
| 70 | 70 |
| 71 bool is_hangouts_app = | 71 bool is_hangouts_app = |
| 72 manifest_url.SchemeIsFileSystem() && | 72 manifest_url.SchemeIsFileSystem() && |
| 73 manifest_url.inner_url() != NULL && | 73 manifest_url.inner_url() != NULL && |
| 74 manifest_url.inner_url()->SchemeIsCryptographic() && | 74 manifest_url.inner_url()->SchemeIsCryptographic() && |
| 75 // The manifest must be loaded from the host's FileSystem. | 75 // The manifest must be loaded from the host's FileSystem. |
| 76 (manifest_url.inner_url()->host() == app_url.host()) && | 76 (manifest_url.inner_url()->host() == app_url.host()) && |
| 77 IsHangoutsUrl(app_url); | 77 IsHangoutsUrl(app_url); |
| 78 | 78 |
| 79 return is_photo_app || is_hangouts_app; | 79 return is_photo_app || is_hangouts_app; |
| 80 } | 80 } |
| OLD | NEW |