summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 20:47:52 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 20:47:52 +0000
commit4dad9ad838f6671fbd67e1c5292525e739e31983 (patch)
tree4d79fc17f12752cc221e0e40d16951677da71f92 /chrome/browser/dom_ui
parent2b3f0f59a6761a41e22007c2c3096e8e18517e08 (diff)
downloadchromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.zip
chromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.tar.gz
chromium_src-4dad9ad838f6671fbd67e1c5292525e739e31983.tar.bz2
Many changes to DictionaryValues:
* Add support for keys with "." in them via new XXXWithoutPathExpansion() APIs. * Use these APIs with all key iterator usage. * SetXXX() calls cannot fail, so change them from bool to void. * Change GetSize() to size() since it's cheap, and add empty(). Other: * Use standard for loop format in more places (e.g. instead of while loops when they're really doing a for loop). * Shorten a few bits of code. BUG=567 TEST=none Review URL: http://codereview.chromium.org/441008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc14
-rw-r--r--chrome/browser/dom_ui/tips_handler.cc2
2 files changed, 6 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 8901d3f9..853a3c9 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -126,7 +126,7 @@ void MostVisitedHandler::StartQueryForMostVisited() {
// we'll be filtering-out the returned list with the blacklist URLs.
// We do not subtract the number of pinned URLs we have because the
// HistoryService does not know about those.
- const int result_count = page_count + url_blacklist_->GetSize();
+ const int result_count = page_count + url_blacklist_->size();
HistoryService* hs =
dom_ui_->GetProfile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
// |hs| may be null during unit tests.
@@ -230,12 +230,8 @@ void MostVisitedHandler::AddPinnedURL(const MostVisitedPage& page, int index) {
DictionaryValue* new_value = new DictionaryValue();
SetMostVisistedPage(new_value, page);
- bool r = new_value->SetInteger(L"index", index);
- DCHECK(r) << "Failed to set the index for a pinned URL from the NTP Most "
- << "Visited.";
-
- r = pinned_urls_->Set(GetDictionaryKeyForURL(page.url.spec()), new_value);
- DCHECK(r) << "Failed to add pinned URL from the NTP Most Visited.";
+ new_value->SetInteger(L"index", index);
+ pinned_urls_->Set(GetDictionaryKeyForURL(page.url.spec()), new_value);
// TODO(arv): Notify observers?
@@ -276,7 +272,7 @@ const bool MostVisitedHandler::GetPinnedURLAtIndex(const int index,
for (DictionaryValue::key_iterator it = pinned_urls_->begin_keys();
it != pinned_urls_->end_keys(); ++it) {
Value* value;
- if (pinned_urls_->Get(*it, &value)) {
+ if (pinned_urls_->GetWithoutPathExpansion(*it, &value)) {
if (!value->IsType(DictionaryValue::TYPE_DICTIONARY)) {
NOTREACHED();
return false;
diff --git a/chrome/browser/dom_ui/tips_handler.cc b/chrome/browser/dom_ui/tips_handler.cc
index 35d3cc2..ee429f7 100644
--- a/chrome/browser/dom_ui/tips_handler.cc
+++ b/chrome/browser/dom_ui/tips_handler.cc
@@ -52,7 +52,7 @@ void TipsHandler::HandleGetTips(const Value* content) {
}
}
- if (tips_cache_ != NULL && tips_cache_->GetSize() != 0) {
+ if (tips_cache_ != NULL && !tips_cache_->empty()) {
if (tips_cache_->GetInteger(
WebResourceService::kCurrentTipPrefName, &current_tip_index) &&
tips_cache_->GetList(