Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/drive/drive_api_util.cc

Issue 89243003: Move EmptyString, kWhitespace and the BOM to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 = UTF8ToUTF16(original_query); 163 base::string16 query = UTF8ToUTF16(original_query);
164 const base::string16 kDelimiter( 164 const base::string16 kDelimiter(
165 kWhitespaceUTF16 + base::string16(1, static_cast<char16>('"'))); 165 base::kWhitespaceUTF16 + base::string16(1, static_cast<char16>('"')));
166 166
167 std::string result; 167 std::string result;
168 for (size_t index = query.find_first_not_of(kWhitespaceUTF16); 168 for (size_t index = query.find_first_not_of(base::kWhitespaceUTF16);
169 index != base::string16::npos; 169 index != base::string16::npos;
170 index = query.find_first_not_of(kWhitespaceUTF16, index)) { 170 index = query.find_first_not_of(base::kWhitespaceUTF16, index)) {
171 bool is_exclusion = (query[index] == '-'); 171 bool is_exclusion = (query[index] == '-');
172 if (is_exclusion) 172 if (is_exclusion)
173 ++index; 173 ++index;
174 if (index == query.length()) { 174 if (index == query.length()) {
175 // Here, the token is '-' and it should be ignored. 175 // Here, the token is '-' and it should be ignored.
176 continue; 176 continue;
177 } 177 }
178 178
179 size_t begin_token = index; 179 size_t begin_token = index;
180 base::string16 token; 180 base::string16 token;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 base::MD5Digest digest; 591 base::MD5Digest digest;
592 base::MD5Final(&digest, &context); 592 base::MD5Final(&digest, &context);
593 return MD5DigestToBase16(digest); 593 return MD5DigestToBase16(digest);
594 } 594 }
595 595
596 const char kWapiRootDirectoryResourceId[] = "folder:root"; 596 const char kWapiRootDirectoryResourceId[] = "folder:root";
597 597
598 } // namespace util 598 } // namespace util
599 } // namespace drive 599 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_test_helper.h ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698