| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 SandboxedPageHandler::SandboxedPageHandler() { | 58 SandboxedPageHandler::SandboxedPageHandler() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 SandboxedPageHandler::~SandboxedPageHandler() { | 61 SandboxedPageHandler::~SandboxedPageHandler() { |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { | 64 bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { |
| 65 scoped_ptr<SandboxedPageInfo> sandboxed_info(new SandboxedPageInfo); | 65 scoped_ptr<SandboxedPageInfo> sandboxed_info(new SandboxedPageInfo); |
| 66 | 66 |
| 67 const base::ListValue* list_value = NULL; | 67 const base::ListValue* list_value = nullptr; |
| 68 if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { | 68 if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { |
| 69 *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); | 69 *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 | 72 |
| 73 for (size_t i = 0; i < list_value->GetSize(); ++i) { | 73 for (size_t i = 0; i < list_value->GetSize(); ++i) { |
| 74 std::string relative_path; | 74 std::string relative_path; |
| 75 if (!list_value->GetString(i, &relative_path)) { | 75 if (!list_value->GetString(i, &relative_path)) { |
| 76 *error = ErrorUtils::FormatErrorMessageUTF16( | 76 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 77 errors::kInvalidSandboxedPage, base::IntToString(i)); | 77 errors::kInvalidSandboxedPage, base::IntToString(i)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 extension->SetManifestData(keys::kSandboxedPages, sandboxed_info.release()); | 114 extension->SetManifestData(keys::kSandboxedPages, sandboxed_info.release()); |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 const std::vector<std::string> SandboxedPageHandler::Keys() const { | 118 const std::vector<std::string> SandboxedPageHandler::Keys() const { |
| 119 return SingleKey(keys::kSandboxedPages); | 119 return SingleKey(keys::kSandboxedPages); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace extensions | 122 } // namespace extensions |
| OLD | NEW |