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

Side by Side Diff: chrome/browser/dom_ui/history2_ui.cc

Issue 3023037: Remove Value/StringValue's ...UTF16() methods in favour of overloading. (Closed)
Patch Set: I'm an idiot. Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/history2_ui.h" 5 #include "chrome/browser/dom_ui/history2_ui.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // Get URLs. 216 // Get URLs.
217 std::set<GURL> urls; 217 std::set<GURL> urls;
218 const ListValue* list_value = static_cast<const ListValue*>(value); 218 const ListValue* list_value = static_cast<const ListValue*>(value);
219 for (ListValue::const_iterator v = list_value->begin() + 1; 219 for (ListValue::const_iterator v = list_value->begin() + 1;
220 v != list_value->end(); ++v) { 220 v != list_value->end(); ++v) {
221 if ((*v)->GetType() != Value::TYPE_STRING) 221 if ((*v)->GetType() != Value::TYPE_STRING)
222 continue; 222 continue;
223 const StringValue* string_value = static_cast<const StringValue*>(*v); 223 const StringValue* string_value = static_cast<const StringValue*>(*v);
224 string16 string16_value; 224 string16 string16_value;
225 if (!string_value->GetAsUTF16(&string16_value)) 225 if (!string_value->GetAsString(&string16_value))
226 continue; 226 continue;
227 urls.insert(GURL(string16_value)); 227 urls.insert(GURL(string16_value));
228 } 228 }
229 229
230 HistoryService* hs = 230 HistoryService* hs =
231 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS); 231 dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
232 hs->ExpireHistoryBetween( 232 hs->ExpireHistoryBetween(
233 urls, begin_time, end_time, &cancelable_delete_consumer_, 233 urls, begin_time, end_time, &cancelable_delete_consumer_,
234 NewCallback(this, &BrowsingHistoryHandler2::RemoveComplete)); 234 NewCallback(this, &BrowsingHistoryHandler2::RemoveComplete));
235 } 235 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 if (value && value->GetType() == Value::TYPE_LIST) { 305 if (value && value->GetType() == Value::TYPE_LIST) {
306 const ListValue* list_value = static_cast<const ListValue*>(value); 306 const ListValue* list_value = static_cast<const ListValue*>(value);
307 Value* list_member; 307 Value* list_member;
308 308
309 // Get search string. 309 // Get search string.
310 if (list_value->Get(0, &list_member) && 310 if (list_value->Get(0, &list_member) &&
311 list_member->GetType() == Value::TYPE_STRING) { 311 list_member->GetType() == Value::TYPE_STRING) {
312 const StringValue* string_value = 312 const StringValue* string_value =
313 static_cast<const StringValue*>(list_member); 313 static_cast<const StringValue*>(list_member);
314 string_value->GetAsUTF16(query); 314 string_value->GetAsString(query);
315 } 315 }
316 316
317 // Get search month. 317 // Get search month.
318 if (list_value->Get(1, &list_member) && 318 if (list_value->Get(1, &list_member) &&
319 list_member->GetType() == Value::TYPE_STRING) { 319 list_member->GetType() == Value::TYPE_STRING) {
320 const StringValue* string_value = 320 const StringValue* string_value =
321 static_cast<const StringValue*>(list_member); 321 static_cast<const StringValue*>(list_member);
322 string16 string16_value; 322 string16 string16_value;
323 string_value->GetAsUTF16(&string16_value); 323 string_value->GetAsString(&string16_value);
324 base::StringToInt(string16_value, month); 324 base::StringToInt(string16_value, month);
325 } 325 }
326 } 326 }
327 } 327 }
328 328
329 history::QueryOptions BrowsingHistoryHandler2::CreateMonthQueryOptions( 329 history::QueryOptions BrowsingHistoryHandler2::CreateMonthQueryOptions(
330 int month) { 330 int month) {
331 history::QueryOptions options; 331 history::QueryOptions options;
332 332
333 // Configure the begin point of the search to the start of the 333 // Configure the begin point of the search to the start of the
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 405 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
406 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 406 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
407 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 407 EscapeQueryParamValue(UTF16ToUTF8(text), true));
408 } 408 }
409 409
410 // static 410 // static
411 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 411 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
412 return ResourceBundle::GetSharedInstance(). 412 return ResourceBundle::GetSharedInstance().
413 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 413 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
414 } 414 }
OLDNEW
« no previous file with comments | « chrome/browser/configuration_policy_provider_win.cc ('k') | chrome/browser/dom_ui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698