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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 std::string sql_str = | 79 std::string sql_str = |
80 "INSERT INTO " + std::string(FullStreamUIPolicy::kTableName) + | 80 "INSERT INTO " + std::string(FullStreamUIPolicy::kTableName) + |
81 " (extension_id, time, action_type, api_name, args, " | 81 " (extension_id, time, action_type, api_name, args, " |
82 "page_url, page_title, arg_url, other) VALUES (?,?,?,?,?,?,?,?,?)"; | 82 "page_url, page_title, arg_url, other) VALUES (?,?,?,?,?,?,?,?,?)"; |
83 sql::Statement statement(db->GetCachedStatement( | 83 sql::Statement statement(db->GetCachedStatement( |
84 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); | 84 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); |
85 | 85 |
86 Action::ActionVector::size_type i; | 86 Action::ActionVector::size_type i; |
87 for (i = 0; i != queued_actions_.size(); ++i) { | 87 for (i = 0; i != queued_actions_.size(); ++i) { |
88 const Action& action = *queued_actions_[i].get(); | 88 const Action& action = *queued_actions_[i]; |
89 statement.Reset(true); | 89 statement.Reset(true); |
90 statement.BindString(0, action.extension_id()); | 90 statement.BindString(0, action.extension_id()); |
91 statement.BindInt64(1, action.time().ToInternalValue()); | 91 statement.BindInt64(1, action.time().ToInternalValue()); |
92 statement.BindInt(2, static_cast<int>(action.action_type())); | 92 statement.BindInt(2, static_cast<int>(action.action_type())); |
93 statement.BindString(3, action.api_name()); | 93 statement.BindString(3, action.api_name()); |
94 if (action.args()) { | 94 if (action.args()) { |
95 statement.BindString(4, Util::Serialize(action.args())); | 95 statement.BindString(4, Util::Serialize(action.args())); |
96 } | 96 } |
97 std::string page_url_string = action.SerializePageUrl(); | 97 std::string page_url_string = action.SerializePageUrl(); |
98 if (!page_url_string.empty()) { | 98 if (!page_url_string.empty()) { |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 447 } |
448 | 448 |
449 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { | 449 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { |
450 if (activity_database()->is_db_valid()) { | 450 if (activity_database()->is_db_valid()) { |
451 queued_actions_.push_back(action); | 451 queued_actions_.push_back(action); |
452 activity_database()->AdviseFlush(queued_actions_.size()); | 452 activity_database()->AdviseFlush(queued_actions_.size()); |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 } // namespace extensions | 456 } // namespace extensions |
OLD | NEW |