| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_permissions_api.h" | 5 #include "chrome/browser/extensions/extension_permissions_api.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_event_router.h" | 9 #include "chrome/browser/extensions/extension_event_router.h" |
| 10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 *bad_message = true; | 108 *bad_message = true; |
| 109 return false; | 109 return false; |
| 110 } | 110 } |
| 111 for (size_t i = 0; i < origin_list->GetSize(); ++i) { | 111 for (size_t i = 0; i < origin_list->GetSize(); ++i) { |
| 112 std::string pattern; | 112 std::string pattern; |
| 113 if (!origin_list->GetString(i, &pattern)) { | 113 if (!origin_list->GetString(i, &pattern)) { |
| 114 *bad_message = true; | 114 *bad_message = true; |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 | 117 |
| 118 URLPattern origin(Extension::kValidHostPermissionSchemes); | 118 URLPattern origin(URLPattern::IGNORE_PORTS, |
| 119 URLPattern::ParseResult parse_result = | 119 Extension::kValidHostPermissionSchemes); |
| 120 origin.Parse(pattern, URLPattern::IGNORE_PORTS); | 120 URLPattern::ParseResult parse_result = origin.Parse(pattern); |
| 121 if (URLPattern::PARSE_SUCCESS != parse_result) { | 121 if (URLPattern::PARSE_SUCCESS != parse_result) { |
| 122 *error = ExtensionErrorUtils::FormatErrorMessage( | 122 *error = ExtensionErrorUtils::FormatErrorMessage( |
| 123 kInvalidOrigin, | 123 kInvalidOrigin, |
| 124 pattern, | 124 pattern, |
| 125 URLPattern::GetParseResultString(parse_result)); | 125 URLPattern::GetParseResultString(parse_result)); |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 origins.AddPattern(origin); | 128 origins.AddPattern(origin); |
| 129 } | 129 } |
| 130 } | 130 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 409 } |
| 410 | 410 |
| 411 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) { | 411 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) { |
| 412 install_ui_.reset(); | 412 install_ui_.reset(); |
| 413 result_.reset(Value::CreateBooleanValue(false)); | 413 result_.reset(Value::CreateBooleanValue(false)); |
| 414 requested_permissions_ = NULL; | 414 requested_permissions_ = NULL; |
| 415 | 415 |
| 416 SendResponse(true); | 416 SendResponse(true); |
| 417 Release(); | 417 Release(); |
| 418 } | 418 } |
| OLD | NEW |