| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 GURL webstore_url = GURL(input); | 69 GURL webstore_url = GURL(input); |
| 70 if (!webstore_url.is_valid()) | 70 if (!webstore_url.is_valid()) |
| 71 return false; | 71 return false; |
| 72 | 72 |
| 73 GURL webstore_base_url = | 73 GURL webstore_base_url = |
| 74 GURL(extension_urls::GetWebstoreItemDetailURLPrefix()); | 74 GURL(extension_urls::GetWebstoreItemDetailURLPrefix()); |
| 75 | 75 |
| 76 if (webstore_url.scheme() != webstore_base_url.scheme() || | 76 if (webstore_url.scheme() != webstore_base_url.scheme() || |
| 77 webstore_url.host() != webstore_base_url.host() || | 77 webstore_url.host() != webstore_base_url.host() || |
| 78 !base::StartsWithASCII(webstore_url.path(), webstore_base_url.path(), | 78 !base::StartsWith(webstore_url.path(), webstore_base_url.path(), |
| 79 true)) { | 79 base::CompareCase::SENSITIVE)) { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 const std::string path = webstore_url.path(); | 83 const std::string path = webstore_url.path(); |
| 84 const size_t last_slash = path.rfind('/'); | 84 const size_t last_slash = path.rfind('/'); |
| 85 if (last_slash == std::string::npos) | 85 if (last_slash == std::string::npos) |
| 86 return false; | 86 return false; |
| 87 | 87 |
| 88 const std::string candidate_id = path.substr(last_slash + 1); | 88 const std::string candidate_id = path.substr(last_slash + 1); |
| 89 if (!crx_file::id_util::IdIsValid(candidate_id)) | 89 if (!crx_file::id_util::IdIsValid(candidate_id)) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 void KioskAppsHandler::ShowError(const std::string& app_id) { | 350 void KioskAppsHandler::ShowError(const std::string& app_id) { |
| 351 base::StringValue app_id_value(app_id); | 351 base::StringValue app_id_value(app_id); |
| 352 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", | 352 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", |
| 353 app_id_value); | 353 app_id_value); |
| 354 | 354 |
| 355 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); | 355 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace chromeos | 358 } // namespace chromeos |
| OLD | NEW |