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

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

Issue 23449016: Update tests to check fields directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_actions.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 (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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 DictionaryValue* mutable_other(); 101 DictionaryValue* mutable_other();
102 102
103 // Helper methods for serializing and deserializing URLs into strings. If 103 // Helper methods for serializing and deserializing URLs into strings. If
104 // the URL is marked as incognito, then the string is prefixed with 104 // the URL is marked as incognito, then the string is prefixed with
105 // kIncognitoUrl ("<incognito>"). 105 // kIncognitoUrl ("<incognito>").
106 std::string SerializePageUrl() const; 106 std::string SerializePageUrl() const;
107 void ParsePageUrl(const std::string& url); 107 void ParsePageUrl(const std::string& url);
108 std::string SerializeArgUrl() const; 108 std::string SerializeArgUrl() const;
109 void ParseArgUrl(const std::string& url); 109 void ParseArgUrl(const std::string& url);
110 110
111 // Number of merged records for this action.
112 int count() const { return count_; }
113 void set_count(int count) { count_ = count; }
114
111 // Flatten the activity's type-specific fields into an ExtensionActivity. 115 // Flatten the activity's type-specific fields into an ExtensionActivity.
112 scoped_ptr<api::activity_log_private::ExtensionActivity> 116 scoped_ptr<api::activity_log_private::ExtensionActivity>
113 ConvertToExtensionActivity(); 117 ConvertToExtensionActivity();
114 118
115 // Print an action as a regular string for debugging purposes. 119 // Print an action as a regular string for debugging purposes.
116 virtual std::string PrintForDebug() const; 120 virtual std::string PrintForDebug() const;
117 121
118 protected: 122 protected:
119 virtual ~Action(); 123 virtual ~Action();
120 124
121 private: 125 private:
122 friend class base::RefCountedThreadSafe<Action>; 126 friend class base::RefCountedThreadSafe<Action>;
123 127
124 std::string extension_id_; 128 std::string extension_id_;
125 base::Time time_; 129 base::Time time_;
126 ActionType action_type_; 130 ActionType action_type_;
127 std::string api_name_; 131 std::string api_name_;
128 scoped_ptr<ListValue> args_; 132 scoped_ptr<ListValue> args_;
129 GURL page_url_; 133 GURL page_url_;
130 std::string page_title_; 134 std::string page_title_;
131 bool page_incognito_; 135 bool page_incognito_;
132 GURL arg_url_; 136 GURL arg_url_;
133 bool arg_incognito_; 137 bool arg_incognito_;
134 scoped_ptr<DictionaryValue> other_; 138 scoped_ptr<DictionaryValue> other_;
139 int count_;
135 140
136 DISALLOW_COPY_AND_ASSIGN(Action); 141 DISALLOW_COPY_AND_ASSIGN(Action);
137 }; 142 };
138 143
139 // A comparator for Action class objects; this performs a lexicographic 144 // A comparator for Action class objects; this performs a lexicographic
140 // comparison of the fields of the Action object (in an unspecfied order). 145 // comparison of the fields of the Action object (in an unspecfied order).
141 // This can be used to use Action objects as keys in STL containers. 146 // This can be used to use Action objects as keys in STL containers.
142 struct ActionComparator { 147 struct ActionComparator {
143 // Evaluates the comparison lhs < rhs. 148 // Evaluates the comparison lhs < rhs.
144 bool operator()(const scoped_refptr<Action>& lhs, 149 bool operator()(const scoped_refptr<Action>& lhs,
145 const scoped_refptr<Action>& rhs) const; 150 const scoped_refptr<Action>& rhs) const;
146 }; 151 };
147 152
148 // Like ActionComparator, but ignores the time field in comparisons. 153 // Like ActionComparator, but ignores the time field in comparisons.
149 struct ActionComparatorExcludingTime { 154 struct ActionComparatorExcludingTime {
150 // Evaluates the comparison lhs < rhs. 155 // Evaluates the comparison lhs < rhs.
151 bool operator()(const scoped_refptr<Action>& lhs, 156 bool operator()(const scoped_refptr<Action>& lhs,
152 const scoped_refptr<Action>& rhs) const; 157 const scoped_refptr<Action>& rhs) const;
153 }; 158 };
154 159
155 } // namespace extensions 160 } // namespace extensions
156 161
157 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_ 162 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_ACTIVITY_ACTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_actions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698