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/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 result.push_back(str[i]); | 60 result.push_back(str[i]); |
61 } | 61 } |
62 return result; | 62 return result; |
63 } | 63 } |
64 | 64 |
65 std::string TranslateQuery(const std::string& original_query) { | 65 std::string TranslateQuery(const std::string& original_query) { |
66 // In order to handle non-ascii white spaces correctly, convert to UTF16. | 66 // In order to handle non-ascii white spaces correctly, convert to UTF16. |
67 base::string16 query = base::UTF8ToUTF16(original_query); | 67 base::string16 query = base::UTF8ToUTF16(original_query); |
68 const base::string16 kDelimiter( | 68 const base::string16 kDelimiter( |
69 base::kWhitespaceUTF16 + | 69 base::kWhitespaceUTF16 + base::ASCIIToUTF16("\"")); |
70 base::string16(1, static_cast<base::char16>('"'))); | |
71 | 70 |
72 std::string result; | 71 std::string result; |
73 for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16); | 72 for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16); |
74 index != base::string16::npos; | 73 index != base::string16::npos; |
75 index = query.find_first_not_of(base::kWhitespaceUTF16, index)) { | 74 index = query.find_first_not_of(base::kWhitespaceUTF16, index)) { |
76 bool is_exclusion = (query[index] == '-'); | 75 bool is_exclusion = (query[index] == '-'); |
77 if (is_exclusion) | 76 if (is_exclusion) |
78 ++index; | 77 ++index; |
79 if (index == query.length()) { | 78 if (index == query.length()) { |
80 // Here, the token is '-' and it should be ignored. | 79 // Here, the token is '-' and it should be ignored. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 430 |
432 base::MD5Digest digest; | 431 base::MD5Digest digest; |
433 base::MD5Final(&digest, &context); | 432 base::MD5Final(&digest, &context); |
434 return MD5DigestToBase16(digest); | 433 return MD5DigestToBase16(digest); |
435 } | 434 } |
436 | 435 |
437 const char kWapiRootDirectoryResourceId[] = "folder:root"; | 436 const char kWapiRootDirectoryResourceId[] = "folder:root"; |
438 | 437 |
439 } // namespace util | 438 } // namespace util |
440 } // namespace drive | 439 } // namespace drive |
OLD | NEW |