OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_enumerator.h" |
9 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/devtools/devtools_window.h" | 14 #include "chrome/browser/devtools/devtools_window.h" |
14 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" | 15 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" |
15 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 16 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
16 #include "chrome/browser/extensions/extension_disabled_ui.h" | 17 #include "chrome/browser/extensions/extension_disabled_ui.h" |
17 #include "chrome/browser/extensions/extension_error_reporter.h" | 18 #include "chrome/browser/extensions/extension_error_reporter.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 73 |
73 std::string contents_base64; | 74 std::string contents_base64; |
74 if (!base::Base64Encode(contents, &contents_base64)) | 75 if (!base::Base64Encode(contents, &contents_base64)) |
75 return GURL(); | 76 return GURL(); |
76 | 77 |
77 const char kDataURLPrefix[] = "data:image;base64,"; | 78 const char kDataURLPrefix[] = "data:image;base64,"; |
78 return GURL(kDataURLPrefix + contents_base64); | 79 return GURL(kDataURLPrefix + contents_base64); |
79 } | 80 } |
80 | 81 |
81 std::vector<base::FilePath> ListFolder(const base::FilePath path) { | 82 std::vector<base::FilePath> ListFolder(const base::FilePath path) { |
82 file_util::FileEnumerator files(path, false, | 83 base::FileEnumerator files(path, false, |
83 file_util::FileEnumerator::DIRECTORIES | 84 base::FileEnumerator::DIRECTORIES | base::FileEnumerator::FILES); |
84 | file_util::FileEnumerator::FILES); | |
85 std::vector<base::FilePath> paths; | 85 std::vector<base::FilePath> paths; |
86 | 86 |
87 for (base::FilePath current_path = files.Next(); !current_path.empty(); | 87 for (base::FilePath current_path = files.Next(); !current_path.empty(); |
88 current_path = files.Next()) { | 88 current_path = files.Next()) { |
89 paths.push_back(current_path); | 89 paths.push_back(current_path); |
90 } | 90 } |
91 return paths; | 91 return paths; |
92 } | 92 } |
93 | 93 |
94 bool ValidateFolderName(const base::FilePath::StringType& name) { | 94 bool ValidateFolderName(const base::FilePath::StringType& name) { |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 | 1279 |
1280 #undef SET_STRING | 1280 #undef SET_STRING |
1281 return true; | 1281 return true; |
1282 } | 1282 } |
1283 | 1283 |
1284 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 1284 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
1285 | 1285 |
1286 } // namespace api | 1286 } // namespace api |
1287 | 1287 |
1288 } // namespace extensions | 1288 } // namespace extensions |
OLD | NEW |