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

Side by Side Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 884213005: Update {virtual,override,final} to follow C++11 style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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) 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/android/provider/chrome_browser_provider.h" 5 #include "chrome/browser/android/provider/chrome_browser_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 DISALLOW_COPY_AND_ASSIGN(AddBookmarkTask); 241 DISALLOW_COPY_AND_ASSIGN(AddBookmarkTask);
242 }; 242 };
243 243
244 // Utility method to remove a bookmark. 244 // Utility method to remove a bookmark.
245 class RemoveBookmarkTask : public BookmarkModelObserverTask { 245 class RemoveBookmarkTask : public BookmarkModelObserverTask {
246 public: 246 public:
247 explicit RemoveBookmarkTask(BookmarkModel* model) 247 explicit RemoveBookmarkTask(BookmarkModel* model)
248 : BookmarkModelObserverTask(model), 248 : BookmarkModelObserverTask(model),
249 deleted_(0), 249 deleted_(0),
250 id_to_delete_(kInvalidBookmarkId) {} 250 id_to_delete_(kInvalidBookmarkId) {}
251 virtual ~RemoveBookmarkTask() {} 251 ~RemoveBookmarkTask() override {}
252 252
253 int Run(const int64 id) { 253 int Run(const int64 id) {
254 id_to_delete_ = id; 254 id_to_delete_ = id;
255 RunOnUIThreadBlocking::Run( 255 RunOnUIThreadBlocking::Run(
256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id)); 256 base::Bind(&RemoveBookmarkTask::RunOnUIThread, model(), id));
257 return deleted_; 257 return deleted_;
258 } 258 }
259 259
260 static void RunOnUIThread(BookmarkModel* model, const int64 id) { 260 static void RunOnUIThread(BookmarkModel* model, const int64 id) {
261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 261 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id); 262 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID(model, id);
263 if (node && node->parent()) { 263 if (node && node->parent()) {
264 const BookmarkNode* parent_node = node->parent(); 264 const BookmarkNode* parent_node = node->parent();
265 model->Remove(parent_node, parent_node->GetIndexOf(node)); 265 model->Remove(parent_node, parent_node->GetIndexOf(node));
266 } 266 }
267 } 267 }
268 268
269 // Verify that the bookmark was actually removed. Called synchronously. 269 // Verify that the bookmark was actually removed. Called synchronously.
270 virtual void BookmarkNodeRemoved( 270 void BookmarkNodeRemoved(BookmarkModel* bookmark_model,
271 BookmarkModel* bookmark_model, 271 const BookmarkNode* parent,
272 const BookmarkNode* parent, 272 int old_index,
273 int old_index, 273 const BookmarkNode* node,
274 const BookmarkNode* node, 274 const std::set<GURL>& removed_urls) override {
275 const std::set<GURL>& removed_urls) override {
276 if (bookmark_model == model() && node->id() == id_to_delete_) 275 if (bookmark_model == model() && node->id() == id_to_delete_)
277 ++deleted_; 276 ++deleted_;
278 } 277 }
279 278
280 private: 279 private:
281 int deleted_; 280 int deleted_;
282 int64 id_to_delete_; 281 int64 id_to_delete_;
283 282
284 DISALLOW_COPY_AND_ASSIGN(RemoveBookmarkTask); 283 DISALLOW_COPY_AND_ASSIGN(RemoveBookmarkTask);
285 }; 284 };
286 285
287 // Utility method to remove all bookmarks that the user can edit. 286 // Utility method to remove all bookmarks that the user can edit.
288 class RemoveAllUserBookmarksTask : public BookmarkModelObserverTask { 287 class RemoveAllUserBookmarksTask : public BookmarkModelObserverTask {
289 public: 288 public:
290 explicit RemoveAllUserBookmarksTask(BookmarkModel* model) 289 explicit RemoveAllUserBookmarksTask(BookmarkModel* model)
291 : BookmarkModelObserverTask(model) {} 290 : BookmarkModelObserverTask(model) {}
292 291
293 virtual ~RemoveAllUserBookmarksTask() {} 292 ~RemoveAllUserBookmarksTask() override {}
294 293
295 void Run() { 294 void Run() {
296 RunOnUIThreadBlocking::Run( 295 RunOnUIThreadBlocking::Run(
297 base::Bind(&RemoveAllUserBookmarksTask::RunOnUIThread, model())); 296 base::Bind(&RemoveAllUserBookmarksTask::RunOnUIThread, model()));
298 } 297 }
299 298
300 static void RunOnUIThread(BookmarkModel* model) { 299 static void RunOnUIThread(BookmarkModel* model) {
301 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
302 model->RemoveAllUserBookmarks(); 301 model->RemoveAllUserBookmarks();
303 } 302 }
304 303
305 private: 304 private:
306 DISALLOW_COPY_AND_ASSIGN(RemoveAllUserBookmarksTask); 305 DISALLOW_COPY_AND_ASSIGN(RemoveAllUserBookmarksTask);
307 }; 306 };
308 307
309 // Utility method to update a bookmark. 308 // Utility method to update a bookmark.
310 class UpdateBookmarkTask : public BookmarkModelObserverTask { 309 class UpdateBookmarkTask : public BookmarkModelObserverTask {
311 public: 310 public:
312 explicit UpdateBookmarkTask(BookmarkModel* model) 311 explicit UpdateBookmarkTask(BookmarkModel* model)
313 : BookmarkModelObserverTask(model), 312 : BookmarkModelObserverTask(model),
314 updated_(0), 313 updated_(0),
315 id_to_update_(kInvalidBookmarkId){} 314 id_to_update_(kInvalidBookmarkId){}
316 virtual ~UpdateBookmarkTask() {} 315 ~UpdateBookmarkTask() override {}
317 316
318 int Run(const int64 id, 317 int Run(const int64 id,
319 const base::string16& title, 318 const base::string16& title,
320 const base::string16& url, 319 const base::string16& url,
321 const int64 parent_id) { 320 const int64 parent_id) {
322 id_to_update_ = id; 321 id_to_update_ = id;
323 RunOnUIThreadBlocking::Run( 322 RunOnUIThreadBlocking::Run(
324 base::Bind(&UpdateBookmarkTask::RunOnUIThread, 323 base::Bind(&UpdateBookmarkTask::RunOnUIThread,
325 model(), id, title, url, parent_id)); 324 model(), id, title, url, parent_id));
326 return updated_; 325 return updated_;
(...skipping 21 matching lines...) Expand all
348 const BookmarkNode* new_parent = 347 const BookmarkNode* new_parent =
349 bookmarks::GetBookmarkNodeByID(model, parent_id); 348 bookmarks::GetBookmarkNodeByID(model, parent_id);
350 349
351 if (new_parent) 350 if (new_parent)
352 model->Move(node, new_parent, 0); 351 model->Move(node, new_parent, 0);
353 } 352 }
354 } 353 }
355 } 354 }
356 355
357 // Verify that the bookmark was actually updated. Called synchronously. 356 // Verify that the bookmark was actually updated. Called synchronously.
358 virtual void BookmarkNodeChanged(BookmarkModel* bookmark_model, 357 void BookmarkNodeChanged(BookmarkModel* bookmark_model,
359 const BookmarkNode* node) override { 358 const BookmarkNode* node) override {
360 if (bookmark_model == model() && node->id() == id_to_update_) 359 if (bookmark_model == model() && node->id() == id_to_update_)
361 ++updated_; 360 ++updated_;
362 } 361 }
363 362
364 private: 363 private:
365 int updated_; 364 int updated_;
366 int64 id_to_update_; 365 int64 id_to_update_;
367 366
368 DISALLOW_COPY_AND_ASSIGN(UpdateBookmarkTask); 367 DISALLOW_COPY_AND_ASSIGN(UpdateBookmarkTask);
369 }; 368 };
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); 1639 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1641 if (obj.is_null()) 1640 if (obj.is_null())
1642 return; 1641 return;
1643 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); 1642 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1644 } 1643 }
1645 1644
1646 void ChromeBrowserProvider::OnKeywordSearchTermDeleted( 1645 void ChromeBrowserProvider::OnKeywordSearchTermDeleted(
1647 HistoryService* history_service, 1646 HistoryService* history_service,
1648 history::URLID url_id) { 1647 history::URLID url_id) {
1649 } 1648 }
OLDNEW
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.h ('k') | chrome/browser/android/recently_closed_tabs_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698