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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 std::string sql_str = | 75 std::string sql_str = |
76 "INSERT INTO " + std::string(FullStreamUIPolicy::kTableName) + | 76 "INSERT INTO " + std::string(FullStreamUIPolicy::kTableName) + |
77 " (extension_id, time, action_type, api_name, args, " | 77 " (extension_id, time, action_type, api_name, args, " |
78 "page_url, page_title, arg_url, other) VALUES (?,?,?,?,?,?,?,?,?)"; | 78 "page_url, page_title, arg_url, other) VALUES (?,?,?,?,?,?,?,?,?)"; |
79 sql::Statement statement(db->GetCachedStatement( | 79 sql::Statement statement(db->GetCachedStatement( |
80 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); | 80 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); |
81 | 81 |
82 Action::ActionVector::size_type i; | 82 Action::ActionVector::size_type i; |
83 for (i = 0; i != queued_actions_.size(); ++i) { | 83 for (i = 0; i != queued_actions_.size(); ++i) { |
84 const Action& action = *queued_actions_[i]; | 84 const Action& action = *queued_actions_[i].get(); |
85 statement.Reset(true); | 85 statement.Reset(true); |
86 statement.BindString(0, action.extension_id()); | 86 statement.BindString(0, action.extension_id()); |
87 statement.BindInt64(1, action.time().ToInternalValue()); | 87 statement.BindInt64(1, action.time().ToInternalValue()); |
88 statement.BindInt(2, static_cast<int>(action.action_type())); | 88 statement.BindInt(2, static_cast<int>(action.action_type())); |
89 statement.BindString(3, action.api_name()); | 89 statement.BindString(3, action.api_name()); |
90 if (action.args()) { | 90 if (action.args()) { |
91 statement.BindString(4, Util::Serialize(action.args())); | 91 statement.BindString(4, Util::Serialize(action.args())); |
92 } | 92 } |
93 std::string page_url_string = action.SerializePageUrl(); | 93 std::string page_url_string = action.SerializePageUrl(); |
94 if (!page_url_string.empty()) { | 94 if (!page_url_string.empty()) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { | 444 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { |
445 if (activity_database()->is_db_valid()) { | 445 if (activity_database()->is_db_valid()) { |
446 queued_actions_.push_back(action); | 446 queued_actions_.push_back(action); |
447 activity_database()->AdviseFlush(queued_actions_.size()); | 447 activity_database()->AdviseFlush(queued_actions_.size()); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 } // namespace extensions | 451 } // namespace extensions |
OLD | NEW |