| 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 "extensions/common/manifest_handlers/sandboxed_page_info.h" | 5 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "extensions/common/csp_validator.h" | 15 #include "extensions/common/csp_validator.h" |
| 15 #include "extensions/common/error_utils.h" | 16 #include "extensions/common/error_utils.h" |
| 16 #include "extensions/common/manifest_constants.h" | 17 #include "extensions/common/manifest_constants.h" |
| 17 #include "extensions/common/url_pattern.h" | 18 #include "extensions/common/url_pattern.h" |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return extension->ResourceMatches(GetPages(extension), relative_path); | 58 return extension->ResourceMatches(GetPages(extension), relative_path); |
| 58 } | 59 } |
| 59 | 60 |
| 60 SandboxedPageHandler::SandboxedPageHandler() { | 61 SandboxedPageHandler::SandboxedPageHandler() { |
| 61 } | 62 } |
| 62 | 63 |
| 63 SandboxedPageHandler::~SandboxedPageHandler() { | 64 SandboxedPageHandler::~SandboxedPageHandler() { |
| 64 } | 65 } |
| 65 | 66 |
| 66 bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { | 67 bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { |
| 67 scoped_ptr<SandboxedPageInfo> sandboxed_info(new SandboxedPageInfo); | 68 std::unique_ptr<SandboxedPageInfo> sandboxed_info(new SandboxedPageInfo); |
| 68 | 69 |
| 69 const base::ListValue* list_value = NULL; | 70 const base::ListValue* list_value = NULL; |
| 70 if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { | 71 if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { |
| 71 *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); | 72 *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); |
| 72 return false; | 73 return false; |
| 73 } | 74 } |
| 74 | 75 |
| 75 for (size_t i = 0; i < list_value->GetSize(); ++i) { | 76 for (size_t i = 0; i < list_value->GetSize(); ++i) { |
| 76 std::string relative_path; | 77 std::string relative_path; |
| 77 if (!list_value->GetString(i, &relative_path)) { | 78 if (!list_value->GetString(i, &relative_path)) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 extension->SetManifestData(keys::kSandboxedPages, sandboxed_info.release()); | 117 extension->SetManifestData(keys::kSandboxedPages, sandboxed_info.release()); |
| 117 return true; | 118 return true; |
| 118 } | 119 } |
| 119 | 120 |
| 120 const std::vector<std::string> SandboxedPageHandler::Keys() const { | 121 const std::vector<std::string> SandboxedPageHandler::Keys() const { |
| 121 return SingleKey(keys::kSandboxedPages); | 122 return SingleKey(keys::kSandboxedPages); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |