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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_actions.h

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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
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 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // The specific API call used or accessed, for example "chrome.tabs.get". 71 // The specific API call used or accessed, for example "chrome.tabs.get".
72 const std::string& api_name() const { return api_name_; } 72 const std::string& api_name() const { return api_name_; }
73 void set_api_name(const std::string& api_name) { api_name_ = api_name; } 73 void set_api_name(const std::string& api_name) { api_name_ = api_name; }
74 74
75 // Any applicable arguments. This might be null to indicate no data 75 // Any applicable arguments. This might be null to indicate no data
76 // available (a distinct condition from an empty argument list). 76 // available (a distinct condition from an empty argument list).
77 // mutable_args() returns a pointer to the list stored in the Action which 77 // mutable_args() returns a pointer to the list stored in the Action which
78 // can be modified in place; if the list was null an empty list is created 78 // can be modified in place; if the list was null an empty list is created
79 // first. 79 // first.
80 const base::ListValue* args() const { return args_.get(); } 80 const base::ListValue* args() const { return args_.get(); }
81 void set_args(scoped_ptr<base::ListValue> args); 81 void set_args(std::unique_ptr<base::ListValue> args);
82 base::ListValue* mutable_args(); 82 base::ListValue* mutable_args();
83 83
84 // The URL of the page which was modified or accessed. 84 // The URL of the page which was modified or accessed.
85 const GURL& page_url() const { return page_url_; } 85 const GURL& page_url() const { return page_url_; }
86 void set_page_url(const GURL& page_url); 86 void set_page_url(const GURL& page_url);
87 87
88 // The title of the above page if available. 88 // The title of the above page if available.
89 const std::string& page_title() const { return page_title_; } 89 const std::string& page_title() const { return page_title_; }
90 void set_page_title(const std::string& title) { page_title_ = title; } 90 void set_page_title(const std::string& title) { page_title_ = title; }
91 91
92 // A URL which appears in the arguments of the API call, if present. 92 // A URL which appears in the arguments of the API call, if present.
93 const GURL& arg_url() const { return arg_url_; } 93 const GURL& arg_url() const { return arg_url_; }
94 void set_arg_url(const GURL& arg_url); 94 void set_arg_url(const GURL& arg_url);
95 95
96 // Get or set a flag indicating whether the page or argument values above 96 // Get or set a flag indicating whether the page or argument values above
97 // refer to incognito pages. 97 // refer to incognito pages.
98 bool page_incognito() const { return page_incognito_; } 98 bool page_incognito() const { return page_incognito_; }
99 void set_page_incognito(bool incognito) { page_incognito_ = incognito; } 99 void set_page_incognito(bool incognito) { page_incognito_ = incognito; }
100 bool arg_incognito() const { return arg_incognito_; } 100 bool arg_incognito() const { return arg_incognito_; }
101 void set_arg_incognito(bool incognito) { arg_incognito_ = incognito; } 101 void set_arg_incognito(bool incognito) { arg_incognito_ = incognito; }
102 102
103 // A dictionary where any additional data can be stored. 103 // A dictionary where any additional data can be stored.
104 const base::DictionaryValue* other() const { return other_.get(); } 104 const base::DictionaryValue* other() const { return other_.get(); }
105 void set_other(scoped_ptr<base::DictionaryValue> other); 105 void set_other(std::unique_ptr<base::DictionaryValue> other);
106 base::DictionaryValue* mutable_other(); 106 base::DictionaryValue* mutable_other();
107 107
108 // An ID that identifies an action stored in the Activity Log database. If the 108 // An ID that identifies an action stored in the Activity Log database. If the
109 // action is not retrieved from the database, e.g., live stream, then the ID 109 // action is not retrieved from the database, e.g., live stream, then the ID
110 // is set to -1. 110 // is set to -1.
111 int64_t action_id() const { return action_id_; } 111 int64_t action_id() const { return action_id_; }
112 112
113 // Helper methods for serializing and deserializing URLs into strings. If 113 // Helper methods for serializing and deserializing URLs into strings. If
114 // the URL is marked as incognito, then the string is prefixed with 114 // the URL is marked as incognito, then the string is prefixed with
115 // kIncognitoUrl ("<incognito>"). 115 // kIncognitoUrl ("<incognito>").
(...skipping 15 matching lines...) Expand all
131 protected: 131 protected:
132 virtual ~Action(); 132 virtual ~Action();
133 133
134 private: 134 private:
135 friend class base::RefCountedThreadSafe<Action>; 135 friend class base::RefCountedThreadSafe<Action>;
136 136
137 std::string extension_id_; 137 std::string extension_id_;
138 base::Time time_; 138 base::Time time_;
139 ActionType action_type_; 139 ActionType action_type_;
140 std::string api_name_; 140 std::string api_name_;
141 scoped_ptr<base::ListValue> args_; 141 std::unique_ptr<base::ListValue> args_;
142 GURL page_url_; 142 GURL page_url_;
143 std::string page_title_; 143 std::string page_title_;
144 bool page_incognito_; 144 bool page_incognito_;
145 GURL arg_url_; 145 GURL arg_url_;
146 bool arg_incognito_; 146 bool arg_incognito_;
147 scoped_ptr<base::DictionaryValue> other_; 147 std::unique_ptr<base::DictionaryValue> other_;
148 int count_; 148 int count_;
149 int64_t action_id_; 149 int64_t action_id_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(Action); 151 DISALLOW_COPY_AND_ASSIGN(Action);
152 }; 152 };
153 153
154 // A comparator for Action class objects; this performs a lexicographic 154 // A comparator for Action class objects; this performs a lexicographic
155 // comparison of the fields of the Action object (in an unspecfied order). 155 // comparison of the fields of the Action object (in an unspecfied order).
156 // This can be used to use Action objects as keys in STL containers. 156 // This can be used to use Action objects as keys in STL containers.
157 struct ActionComparator { 157 struct ActionComparator {
158 // Evaluates the comparison lhs < rhs. 158 // Evaluates the comparison lhs < rhs.
159 bool operator()(const scoped_refptr<Action>& lhs, 159 bool operator()(const scoped_refptr<Action>& lhs,
160 const scoped_refptr<Action>& rhs) const; 160 const scoped_refptr<Action>& rhs) const;
161 }; 161 };
162 162
163 // Like ActionComparator, but ignores the time field and the action ID field in 163 // Like ActionComparator, but ignores the time field and the action ID field in
164 // comparisons. 164 // comparisons.
165 struct ActionComparatorExcludingTimeAndActionId { 165 struct ActionComparatorExcludingTimeAndActionId {
166 // Evaluates the comparison lhs < rhs. 166 // Evaluates the comparison lhs < rhs.
167 bool operator()(const scoped_refptr<Action>& lhs, 167 bool operator()(const scoped_refptr<Action>& lhs,
168 const scoped_refptr<Action>& rhs) const; 168 const scoped_refptr<Action>& rhs) const;
169 }; 169 };
170 170
171 } // namespace extensions 171 } // namespace extensions
172 172
173 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ 173 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/active_tab_unittest.cc ('k') | chrome/browser/extensions/activity_log/activity_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698