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

Side by Side Diff: components/history/core/browser/top_sites_impl.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "components/history/core/browser/top_sites_impl.h" 5 #include "components/history/core/browser/top_sites_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/md5.h" 16 #include "base/md5.h"
17 #include "base/memory/ptr_util.h"
17 #include "base/memory/ref_counted_memory.h" 18 #include "base/memory/ref_counted_memory.h"
18 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
19 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
22 #include "base/task_runner.h" 23 #include "base/task_runner.h"
23 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
24 #include "base/values.h" 25 #include "base/values.h"
25 #include "build/build_config.h" 26 #include "build/build_config.h"
26 #include "components/history/core/browser/history_backend.h" 27 #include "components/history/core/browser/history_backend.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 285
285 bool TopSitesImpl::HasBlacklistedItems() const { 286 bool TopSitesImpl::HasBlacklistedItems() const {
286 const base::DictionaryValue* blacklist = 287 const base::DictionaryValue* blacklist =
287 pref_service_->GetDictionary(kMostVisitedURLsBlacklist); 288 pref_service_->GetDictionary(kMostVisitedURLsBlacklist);
288 return blacklist && !blacklist->empty(); 289 return blacklist && !blacklist->empty();
289 } 290 }
290 291
291 void TopSitesImpl::AddBlacklistedURL(const GURL& url) { 292 void TopSitesImpl::AddBlacklistedURL(const GURL& url) {
292 DCHECK(thread_checker_.CalledOnValidThread()); 293 DCHECK(thread_checker_.CalledOnValidThread());
293 294
294 std::unique_ptr<base::Value> dummy = base::Value::CreateNullValue(); 295 auto dummy = base::MakeUnique<base::Value>();
295 { 296 {
296 DictionaryPrefUpdate update(pref_service_, kMostVisitedURLsBlacklist); 297 DictionaryPrefUpdate update(pref_service_, kMostVisitedURLsBlacklist);
297 base::DictionaryValue* blacklist = update.Get(); 298 base::DictionaryValue* blacklist = update.Get();
298 blacklist->SetWithoutPathExpansion(GetURLHash(url), std::move(dummy)); 299 blacklist->SetWithoutPathExpansion(GetURLHash(url), std::move(dummy));
299 } 300 }
300 301
301 ResetThreadSafeCache(); 302 ResetThreadSafeCache();
302 NotifyTopSitesChanged(TopSitesObserver::ChangeReason::BLACKLIST); 303 NotifyTopSitesChanged(TopSitesObserver::ChangeReason::BLACKLIST);
303 } 304 }
304 305
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin(); 891 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin();
891 i != indices_to_delete.rend(); i++) { 892 i != indices_to_delete.rend(); i++) {
892 new_top_sites.erase(new_top_sites.begin() + *i); 893 new_top_sites.erase(new_top_sites.begin() + *i);
893 } 894 }
894 SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES); 895 SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES);
895 } 896 }
896 StartQueryForMostVisited(); 897 StartQueryForMostVisited();
897 } 898 }
898 899
899 } // namespace history 900 } // namespace history
OLDNEW
« no previous file with comments | « components/dom_distiller/ios/distiller_page_ios.mm ('k') | components/json_schema/json_schema_validator_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698