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

Side by Side Diff: chrome/browser/history/shortcuts_backend.cc

Issue 9111032: Change over IgnoreReturn to IgnoreResult. remove IgnoreReturn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix it for realz Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/history/shortcuts_backend.h" 5 #include "chrome/browser/history/shortcuts_backend.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (!initialized()) 66 if (!initialized())
67 return false; 67 return false;
68 DCHECK(guid_map_.find(shortcut.id) == guid_map_.end()); 68 DCHECK(guid_map_.find(shortcut.id) == guid_map_.end());
69 guid_map_[shortcut.id] = shortcuts_map_.insert( 69 guid_map_[shortcut.id] = shortcuts_map_.insert(
70 std::make_pair(base::i18n::ToLower(shortcut.text), shortcut)); 70 std::make_pair(base::i18n::ToLower(shortcut.text), shortcut));
71 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, 71 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_,
72 OnShortcutsChanged()); 72 OnShortcutsChanged());
73 if (no_db_access_) 73 if (no_db_access_)
74 return true; 74 return true;
75 return BrowserThread::PostTask( 75 return BrowserThread::PostTask(
76 BrowserThread::DB, FROM_HERE, base::IgnoreReturn<bool>( 76 BrowserThread::DB, FROM_HERE,
77 base::Bind(&ShortcutsDatabase::AddShortcut, db_.get(), shortcut))); 77 base::Bind(base::IgnoreResult(&ShortcutsDatabase::AddShortcut),
78 db_.get(), shortcut));
78 } 79 }
79 80
80 bool ShortcutsBackend::UpdateShortcut( 81 bool ShortcutsBackend::UpdateShortcut(
81 const shortcuts_provider::Shortcut& shortcut) { 82 const shortcuts_provider::Shortcut& shortcut) {
82 if (!initialized()) 83 if (!initialized())
83 return false; 84 return false;
84 shortcuts_provider::GuidToShortcutsIteratorMap::iterator it = 85 shortcuts_provider::GuidToShortcutsIteratorMap::iterator it =
85 guid_map_.find(shortcut.id); 86 guid_map_.find(shortcut.id);
86 if (it != guid_map_.end()) 87 if (it != guid_map_.end())
87 shortcuts_map_.erase(it->second); 88 shortcuts_map_.erase(it->second);
88 guid_map_[shortcut.id] = shortcuts_map_.insert( 89 guid_map_[shortcut.id] = shortcuts_map_.insert(
89 std::make_pair(base::i18n::ToLower(shortcut.text), shortcut)); 90 std::make_pair(base::i18n::ToLower(shortcut.text), shortcut));
90 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, 91 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_,
91 OnShortcutsChanged()); 92 OnShortcutsChanged());
92 if (no_db_access_) 93 if (no_db_access_)
93 return true; 94 return true;
94 return BrowserThread::PostTask( 95 return BrowserThread::PostTask(
95 BrowserThread::DB, FROM_HERE, base::IgnoreReturn<bool>( 96 BrowserThread::DB, FROM_HERE,
96 base::Bind(&ShortcutsDatabase::UpdateShortcut, db_.get(), shortcut))); 97 base::Bind(base::IgnoreResult(&ShortcutsDatabase::UpdateShortcut),
98 db_.get(), shortcut));
97 } 99 }
98 100
99 bool ShortcutsBackend::DeleteShortcutsWithIds( 101 bool ShortcutsBackend::DeleteShortcutsWithIds(
100 const std::vector<std::string>& shortcut_ids) { 102 const std::vector<std::string>& shortcut_ids) {
101 if (!initialized()) 103 if (!initialized())
102 return false; 104 return false;
103 for (size_t i = 0; i < shortcut_ids.size(); ++i) { 105 for (size_t i = 0; i < shortcut_ids.size(); ++i) {
104 shortcuts_provider::GuidToShortcutsIteratorMap::iterator it = 106 shortcuts_provider::GuidToShortcutsIteratorMap::iterator it =
105 guid_map_.find(shortcut_ids[i]); 107 guid_map_.find(shortcut_ids[i]);
106 if (it != guid_map_.end()) { 108 if (it != guid_map_.end()) {
107 shortcuts_map_.erase(it->second); 109 shortcuts_map_.erase(it->second);
108 guid_map_.erase(it); 110 guid_map_.erase(it);
109 } 111 }
110 } 112 }
111 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, 113 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_,
112 OnShortcutsChanged()); 114 OnShortcutsChanged());
113 if (no_db_access_) 115 if (no_db_access_)
114 return true; 116 return true;
115 return BrowserThread::PostTask( 117 return BrowserThread::PostTask(
116 BrowserThread::DB, FROM_HERE, base::IgnoreReturn<bool>( 118 BrowserThread::DB, FROM_HERE,
117 base::Bind(&ShortcutsDatabase::DeleteShortcutsWithIds, db_.get(), 119 base::Bind(
118 shortcut_ids))); 120 base::IgnoreResult(&ShortcutsDatabase::DeleteShortcutsWithIds),
121 db_.get(), shortcut_ids));
119 } 122 }
120 123
121 bool ShortcutsBackend::DeleteShortcutsWithUrl(const GURL& shortcut_url) { 124 bool ShortcutsBackend::DeleteShortcutsWithUrl(const GURL& shortcut_url) {
122 if (!initialized()) 125 if (!initialized())
123 return false; 126 return false;
124 std::vector<std::string> shortcut_ids; 127 std::vector<std::string> shortcut_ids;
125 for (shortcuts_provider::GuidToShortcutsIteratorMap::iterator 128 for (shortcuts_provider::GuidToShortcutsIteratorMap::iterator
126 it = guid_map_.begin(); 129 it = guid_map_.begin();
127 it != guid_map_.end();) { 130 it != guid_map_.end();) {
128 if (it->second->second.url == shortcut_url) { 131 if (it->second->second.url == shortcut_url) {
129 shortcut_ids.push_back(it->first); 132 shortcut_ids.push_back(it->first);
130 shortcuts_map_.erase(it->second); 133 shortcuts_map_.erase(it->second);
131 guid_map_.erase(it++); 134 guid_map_.erase(it++);
132 } else { 135 } else {
133 ++it; 136 ++it;
134 } 137 }
135 } 138 }
136 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, 139 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_,
137 OnShortcutsChanged()); 140 OnShortcutsChanged());
138 if (no_db_access_) 141 if (no_db_access_)
139 return true; 142 return true;
140 return BrowserThread::PostTask( 143 return BrowserThread::PostTask(
141 BrowserThread::DB, FROM_HERE, base::IgnoreReturn<bool>( 144 BrowserThread::DB, FROM_HERE,
142 base::Bind(&ShortcutsDatabase::DeleteShortcutsWithUrl, db_.get(), 145 base::Bind(
143 shortcut_url.spec()))); 146 base::IgnoreResult(&ShortcutsDatabase::DeleteShortcutsWithUrl),
147 db_.get(), shortcut_url.spec()));
144 } 148 }
145 149
146 bool ShortcutsBackend::DeleteAllShortcuts() { 150 bool ShortcutsBackend::DeleteAllShortcuts() {
147 if (!initialized()) 151 if (!initialized())
148 return false; 152 return false;
149 shortcuts_map_.clear(); 153 shortcuts_map_.clear();
150 guid_map_.clear(); 154 guid_map_.clear();
151 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, 155 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_,
152 OnShortcutsChanged()); 156 OnShortcutsChanged());
153 if (no_db_access_) 157 if (no_db_access_)
154 return true; 158 return true;
155 return BrowserThread::PostTask( 159 return BrowserThread::PostTask(
156 BrowserThread::DB, FROM_HERE, base::IgnoreReturn<bool>( 160 BrowserThread::DB, FROM_HERE,
157 base::Bind(&ShortcutsDatabase::DeleteAllShortcuts, db_.get()))); 161 base::Bind(
162 base::IgnoreResult(&ShortcutsDatabase::DeleteAllShortcuts),
163 db_.get()));
158 } 164 }
159 165
160 void ShortcutsBackend::InitInternal() { 166 void ShortcutsBackend::InitInternal() {
161 DCHECK(current_state_ == INITIALIZING); 167 DCHECK(current_state_ == INITIALIZING);
162 db_->Init(); 168 db_->Init();
163 shortcuts_provider::GuidToShortcutMap shortcuts; 169 shortcuts_provider::GuidToShortcutMap shortcuts;
164 db_->LoadShortcuts(&shortcuts); 170 db_->LoadShortcuts(&shortcuts);
165 temp_shortcuts_map_.reset(new shortcuts_provider::ShortcutMap); 171 temp_shortcuts_map_.reset(new shortcuts_provider::ShortcutMap);
166 temp_guid_map_.reset(new shortcuts_provider::GuidToShortcutsIteratorMap); 172 temp_guid_map_.reset(new shortcuts_provider::GuidToShortcutsIteratorMap);
167 for (shortcuts_provider::GuidToShortcutMap::iterator it = shortcuts.begin(); 173 for (shortcuts_provider::GuidToShortcutMap::iterator it = shortcuts.begin();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 else 242 else
237 shortcut.id = id; 243 shortcut.id = id;
238 244
239 if (number_of_hits == 1) 245 if (number_of_hits == 1)
240 AddShortcut(shortcut); 246 AddShortcut(shortcut);
241 else 247 else
242 UpdateShortcut(shortcut); 248 UpdateShortcut(shortcut);
243 } 249 }
244 250
245 } // namespace history 251 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/password_manager/native_backend_gnome_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698