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

Side by Side Diff: chrome/browser/ui/sync/profile_signin_confirmation_helper.cc

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/sync/profile_signin_confirmation_helper.h" 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 24 matching lines...) Expand all
35 35
36 const int kHistoryEntriesBeforeNewProfilePrompt = 10; 36 const int kHistoryEntriesBeforeNewProfilePrompt = 10;
37 37
38 // Determines whether a profile has any typed URLs in its history. 38 // Determines whether a profile has any typed URLs in its history.
39 class HasTypedURLsTask : public history::HistoryDBTask { 39 class HasTypedURLsTask : public history::HistoryDBTask {
40 public: 40 public:
41 explicit HasTypedURLsTask(const base::Callback<void(bool)>& cb) 41 explicit HasTypedURLsTask(const base::Callback<void(bool)>& cb)
42 : has_typed_urls_(false), cb_(cb) { 42 : has_typed_urls_(false), cb_(cb) {
43 } 43 }
44 44
45 virtual bool RunOnDBThread(history::HistoryBackend* backend, 45 bool RunOnDBThread(history::HistoryBackend* backend,
46 history::HistoryDatabase* db) override { 46 history::HistoryDatabase* db) override {
47 history::URLRows rows; 47 history::URLRows rows;
48 backend->GetAllTypedURLs(&rows); 48 backend->GetAllTypedURLs(&rows);
49 if (!rows.empty()) { 49 if (!rows.empty()) {
50 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains " 50 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains "
51 << rows.size() << " typed URLs"; 51 << rows.size() << " typed URLs";
52 has_typed_urls_ = true; 52 has_typed_urls_ = true;
53 } 53 }
54 return true; 54 return true;
55 } 55 }
56 56
57 virtual void DoneRunOnMainThread() override { 57 void DoneRunOnMainThread() override { cb_.Run(has_typed_urls_); }
58 cb_.Run(has_typed_urls_);
59 }
60 58
61 private: 59 private:
62 virtual ~HasTypedURLsTask() {} 60 ~HasTypedURLsTask() override {}
63 61
64 bool has_typed_urls_; 62 bool has_typed_urls_;
65 base::Callback<void(bool)> cb_; 63 base::Callback<void(bool)> cb_;
66 }; 64 };
67 65
68 bool HasBookmarks(Profile* profile) { 66 bool HasBookmarks(Profile* profile) {
69 BookmarkModel* bookmarks = BookmarkModelFactory::GetForProfile(profile); 67 BookmarkModel* bookmarks = BookmarkModelFactory::GetForProfile(profile);
70 bool has_bookmarks = bookmarks && bookmarks->HasBookmarks(); 68 bool has_bookmarks = bookmarks && bookmarks->HasBookmarks();
71 if (has_bookmarks) 69 if (has_bookmarks)
72 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains bookmarks"; 70 DVLOG(1) << "ProfileSigninConfirmationHelper: profile contains bookmarks";
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return; 239 return;
242 } 240 }
243 // Fire asynchronous queries for profile data. 241 // Fire asynchronous queries for profile data.
244 ProfileSigninConfirmationHelper* helper = 242 ProfileSigninConfirmationHelper* helper =
245 new ProfileSigninConfirmationHelper(profile, return_result); 243 new ProfileSigninConfirmationHelper(profile, return_result);
246 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt); 244 helper->CheckHasHistory(kHistoryEntriesBeforeNewProfilePrompt);
247 helper->CheckHasTypedURLs(); 245 helper->CheckHasTypedURLs();
248 } 246 }
249 247
250 } // namespace ui 248 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698