OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/activity_log/fullstream_ui_policy.h" | 5 #include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 if (!page_url.empty()) { | 152 if (!page_url.empty()) { |
153 where_str += where_next + "page_url LIKE ?"; | 153 where_str += where_next + "page_url LIKE ?"; |
154 where_next = " AND "; | 154 where_next = " AND "; |
155 } | 155 } |
156 if (!arg_url.empty()) { | 156 if (!arg_url.empty()) { |
157 where_str += where_next + "arg_url LIKE ?"; | 157 where_str += where_next + "arg_url LIKE ?"; |
158 } | 158 } |
159 std::string query_str = base::StringPrintf( | 159 std::string query_str = base::StringPrintf( |
160 "SELECT extension_id,time,action_type,api_name,args,page_url,page_title," | 160 "SELECT extension_id,time,action_type,api_name,args,page_url,page_title," |
161 "arg_url,other FROM %s WHERE %s ORDER BY time DESC", | 161 "arg_url,other FROM %s WHERE %s ORDER BY time DESC LIMIT 300", |
162 kTableName, | 162 kTableName, |
163 where_str.c_str()); | 163 where_str.c_str()); |
164 sql::Statement query(db->GetUniqueStatement(query_str.c_str())); | 164 sql::Statement query(db->GetUniqueStatement(query_str.c_str())); |
165 int i = -1; | 165 int i = -1; |
166 if (!extension_id.empty()) | 166 if (!extension_id.empty()) |
167 query.BindString(++i, extension_id); | 167 query.BindString(++i, extension_id); |
168 if (!api_name.empty()) | 168 if (!api_name.empty()) |
169 query.BindString(++i, api_name); | 169 query.BindString(++i, api_name); |
170 if (type != Action::ACTION_ANY) | 170 if (type != Action::ACTION_ANY) |
171 query.BindInt(++i, static_cast<int>(type)); | 171 query.BindInt(++i, static_cast<int>(type)); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 | 410 |
411 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { | 411 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { |
412 if (activity_database()->is_db_valid()) { | 412 if (activity_database()->is_db_valid()) { |
413 queued_actions_.push_back(action); | 413 queued_actions_.push_back(action); |
414 activity_database()->AdviseFlush(queued_actions_.size()); | 414 activity_database()->AdviseFlush(queued_actions_.size()); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 } // namespace extensions | 418 } // namespace extensions |
OLD | NEW |