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

Side by Side Diff: chrome/browser/autocomplete/search_provider.cc

Issue 31014: Port DictionaryValue to use string16 instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months 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
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_codec.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/google_util.h" 10 #include "chrome/browser/google_util.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // 5th argument: Optional key-value pairs. 295 // 5th argument: Optional key-value pairs.
296 // TODO: We may iterate the 5th+ arguments of the root_list if any other 296 // TODO: We may iterate the 5th+ arguments of the root_list if any other
297 // optional data are defined. 297 // optional data are defined.
298 if (root_list->GetSize() > 4) { 298 if (root_list->GetSize() > 4) {
299 Value* optional_val; 299 Value* optional_val;
300 if (root_list->Get(4, &optional_val) && 300 if (root_list->Get(4, &optional_val) &&
301 optional_val->IsType(Value::TYPE_DICTIONARY)) { 301 optional_val->IsType(Value::TYPE_DICTIONARY)) {
302 DictionaryValue* dict_val = static_cast<DictionaryValue*>(optional_val); 302 DictionaryValue* dict_val = static_cast<DictionaryValue*>(optional_val);
303 303
304 // Parse Google Suggest specific type extension. 304 // Parse Google Suggest specific type extension.
305 static const std::wstring kGoogleSuggestType(L"google:suggesttype"); 305 static const string16 kGoogleSuggestType(
306 ASCIIToUTF16("google:suggesttype"));
306 if (dict_val->HasKey(kGoogleSuggestType)) 307 if (dict_val->HasKey(kGoogleSuggestType))
307 dict_val->GetList(kGoogleSuggestType, &type_list); 308 dict_val->GetList(kGoogleSuggestType, &type_list);
308 } 309 }
309 } 310 }
310 311
311 ListValue* result_list = static_cast<ListValue*>(result_val); 312 ListValue* result_list = static_cast<ListValue*>(result_val);
312 for (size_t i = 0; i < result_list->GetSize(); ++i) { 313 for (size_t i = 0; i < result_list->GetSize(); ++i) {
313 Value* suggestion_val; 314 Value* suggestion_val;
314 std::wstring suggestion_str; 315 std::wstring suggestion_str;
315 if (!result_list->Get(i, &suggestion_val) || 316 if (!result_list->Get(i, &suggestion_val) ||
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 const size_t after_slashes = std::min(url->length(), 618 const size_t after_slashes = std::min(url->length(),
618 static_cast<size_t>(scheme.end() + 3)); 619 static_cast<size_t>(scheme.end() + 3));
619 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/')) 620 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/'))
620 ++prefix_len; 621 ++prefix_len;
621 if (prefix_len == url->length()) 622 if (prefix_len == url->length())
622 url->clear(); 623 url->clear();
623 else 624 else
624 url->erase(url->begin(), url->begin() + prefix_len); 625 url->erase(url->begin(), url->begin() + prefix_len);
625 return prefix_len; 626 return prefix_len;
626 } 627 }
OLDNEW
« no previous file with comments | « base/values_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698