| 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/drive/drive_api_util.h" | 5 #include "chrome/browser/drive/drive_api_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/scoped_platform_file_closer.h" | 10 #include "base/files/scoped_platform_file_closer.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 result.push_back(str[i]); | 156 result.push_back(str[i]); |
| 157 } | 157 } |
| 158 return result; | 158 return result; |
| 159 } | 159 } |
| 160 | 160 |
| 161 std::string TranslateQuery(const std::string& original_query) { | 161 std::string TranslateQuery(const std::string& original_query) { |
| 162 // In order to handle non-ascii white spaces correctly, convert to UTF16. | 162 // In order to handle non-ascii white spaces correctly, convert to UTF16. |
| 163 base::string16 query = base::UTF8ToUTF16(original_query); | 163 base::string16 query = base::UTF8ToUTF16(original_query); |
| 164 const base::string16 kDelimiter( | 164 const base::string16 kDelimiter( |
| 165 base::kWhitespaceUTF16 + base::string16(1, static_cast<char16>('"'))); | 165 base::kWhitespaceUTF16 + |
| 166 base::string16(1, static_cast<base::char16>('"'))); |
| 166 | 167 |
| 167 std::string result; | 168 std::string result; |
| 168 for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16); | 169 for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16); |
| 169 index != base::string16::npos; | 170 index != base::string16::npos; |
| 170 index = query.find_first_not_of(base::kWhitespaceUTF16, index)) { | 171 index = query.find_first_not_of(base::kWhitespaceUTF16, index)) { |
| 171 bool is_exclusion = (query[index] == '-'); | 172 bool is_exclusion = (query[index] == '-'); |
| 172 if (is_exclusion) | 173 if (is_exclusion) |
| 173 ++index; | 174 ++index; |
| 174 if (index == query.length()) { | 175 if (index == query.length()) { |
| 175 // Here, the token is '-' and it should be ignored. | 176 // Here, the token is '-' and it should be ignored. |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 595 |
| 595 base::MD5Digest digest; | 596 base::MD5Digest digest; |
| 596 base::MD5Final(&digest, &context); | 597 base::MD5Final(&digest, &context); |
| 597 return MD5DigestToBase16(digest); | 598 return MD5DigestToBase16(digest); |
| 598 } | 599 } |
| 599 | 600 |
| 600 const char kWapiRootDirectoryResourceId[] = "folder:root"; | 601 const char kWapiRootDirectoryResourceId[] = "folder:root"; |
| 601 | 602 |
| 602 } // namespace util | 603 } // namespace util |
| 603 } // namespace drive | 604 } // namespace drive |
| OLD | NEW |