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

Side by Side Diff: components/ntp_snippets/ntp_snippets_database.cc

Issue 2368583002: [NTP Snippets] Cleanups from clang-tidy (Closed)
Patch Set: rebase Created 4 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
« no previous file with comments | « components/ntp_snippets/ntp_snippet.cc ('k') | components/ntp_snippets/ntp_snippets_fetcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ntp_snippets/ntp_snippets_database.h" 5 #include "components/ntp_snippets/ntp_snippets_database.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "components/leveldb_proto/proto_database_impl.h" 10 #include "components/leveldb_proto/proto_database_impl.h"
(...skipping 29 matching lines...) Expand all
40 database_->Init(kDatabaseUMAClientName, snippet_dir, 40 database_->Init(kDatabaseUMAClientName, snippet_dir,
41 base::Bind(&NTPSnippetsDatabase::OnDatabaseInited, 41 base::Bind(&NTPSnippetsDatabase::OnDatabaseInited,
42 weak_ptr_factory_.GetWeakPtr())); 42 weak_ptr_factory_.GetWeakPtr()));
43 43
44 base::FilePath image_dir = database_dir.AppendASCII(kImageDatabaseFolder); 44 base::FilePath image_dir = database_dir.AppendASCII(kImageDatabaseFolder);
45 image_database_->Init(kImageDatabaseUMAClientName, image_dir, 45 image_database_->Init(kImageDatabaseUMAClientName, image_dir,
46 base::Bind(&NTPSnippetsDatabase::OnImageDatabaseInited, 46 base::Bind(&NTPSnippetsDatabase::OnImageDatabaseInited,
47 weak_ptr_factory_.GetWeakPtr())); 47 weak_ptr_factory_.GetWeakPtr()));
48 } 48 }
49 49
50 NTPSnippetsDatabase::~NTPSnippetsDatabase() {} 50 NTPSnippetsDatabase::~NTPSnippetsDatabase() = default;
51 51
52 bool NTPSnippetsDatabase::IsInitialized() const { 52 bool NTPSnippetsDatabase::IsInitialized() const {
53 return !IsErrorState() && database_initialized_ && 53 return !IsErrorState() && database_initialized_ &&
54 image_database_initialized_; 54 image_database_initialized_;
55 } 55 }
56 56
57 bool NTPSnippetsDatabase::IsErrorState() const { 57 bool NTPSnippetsDatabase::IsErrorState() const {
58 return !database_ || !image_database_; 58 return !database_ || !image_database_;
59 } 59 }
60 60
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 std::unique_ptr<std::vector<std::string>> keys_to_remove) { 284 std::unique_ptr<std::vector<std::string>> keys_to_remove) {
285 DCHECK(IsInitialized()); 285 DCHECK(IsInitialized());
286 286
287 image_database_->UpdateEntries( 287 image_database_->UpdateEntries(
288 base::MakeUnique<ImageKeyEntryVector>(), std::move(keys_to_remove), 288 base::MakeUnique<ImageKeyEntryVector>(), std::move(keys_to_remove),
289 base::Bind(&NTPSnippetsDatabase::OnImageDatabaseSaved, 289 base::Bind(&NTPSnippetsDatabase::OnImageDatabaseSaved,
290 weak_ptr_factory_.GetWeakPtr())); 290 weak_ptr_factory_.GetWeakPtr()));
291 } 291 }
292 292
293 } // namespace ntp_snippets 293 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/ntp_snippet.cc ('k') | components/ntp_snippets/ntp_snippets_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698