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

Side by Side Diff: components/ntp_snippets/ntp_snippet.h

Issue 1851933002: Convert //url to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixup 7 Created 4 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
« no previous file with comments | « components/domain_reliability/uploader.cc ('k') | components/ntp_snippets/ntp_snippet.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 namespace base { 15 namespace base {
15 class DictionaryValue; 16 class DictionaryValue;
16 } 17 }
17 18
18 namespace ntp_snippets { 19 namespace ntp_snippets {
19 20
20 // Stores and vend fresh content data for the NTP. This is a dumb class with no 21 // Stores and vend fresh content data for the NTP. This is a dumb class with no
21 // smarts at all, all the logic is in the service. 22 // smarts at all, all the logic is in the service.
22 class NTPSnippet { 23 class NTPSnippet {
23 public: 24 public:
24 // Creates a new snippet with the given URL. URL must be valid. 25 // Creates a new snippet with the given URL. URL must be valid.
25 NTPSnippet(const GURL& url); 26 NTPSnippet(const GURL& url);
26 27
27 ~NTPSnippet(); 28 ~NTPSnippet();
28 29
29 // Creates an NTPSnippet from a dictionary. Returns a null pointer if the 30 // Creates an NTPSnippet from a dictionary. Returns a null pointer if the
30 // dictionary doesn't contain at least a url. The keys in the dictionary are 31 // dictionary doesn't contain at least a url. The keys in the dictionary are
31 // expected to be the same as the property name, with exceptions documented in 32 // expected to be the same as the property name, with exceptions documented in
32 // the property comment. 33 // the property comment.
33 static scoped_ptr<NTPSnippet> CreateFromDictionary( 34 static std::unique_ptr<NTPSnippet> CreateFromDictionary(
34 const base::DictionaryValue& dict); 35 const base::DictionaryValue& dict);
35 36
36 scoped_ptr<base::DictionaryValue> ToDictionary() const; 37 std::unique_ptr<base::DictionaryValue> ToDictionary() const;
37 38
38 // URL of the page described by this snippet. 39 // URL of the page described by this snippet.
39 const GURL& url() const { return url_; } 40 const GURL& url() const { return url_; }
40 41
41 // Subtitle to identify the site the snippet is from. 42 // Subtitle to identify the site the snippet is from.
42 const std::string& site_title() const { return site_title_; } 43 const std::string& site_title() const { return site_title_; }
43 void set_site_title(const std::string& site_title) { 44 void set_site_title(const std::string& site_title) {
44 site_title_ = site_title; 45 site_title_ = site_title;
45 } 46 }
46 47
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 std::string snippet_; 88 std::string snippet_;
88 base::Time publish_date_; 89 base::Time publish_date_;
89 base::Time expiry_date_; 90 base::Time expiry_date_;
90 91
91 DISALLOW_COPY_AND_ASSIGN(NTPSnippet); 92 DISALLOW_COPY_AND_ASSIGN(NTPSnippet);
92 }; 93 };
93 94
94 } // namespace ntp_snippets 95 } // namespace ntp_snippets
95 96
96 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_ 97 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPET_H_
OLDNEW
« no previous file with comments | « components/domain_reliability/uploader.cc ('k') | components/ntp_snippets/ntp_snippet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698