| Index: chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
|
| diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
|
| index 1546830746529c10214ed5827e5f4f261d3799e3..32fb3f80720f804f1bb454e881b1d0d051a0b8a5 100644
|
| --- a/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
|
| +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy.cc
|
| @@ -205,7 +205,6 @@ scoped_ptr<Action::ActionVector> FullStreamUIPolicy::DoReadFilteredData(
|
| }
|
| actions->push_back(action);
|
| }
|
| -
|
| return actions.Pass();
|
| }
|
|
|
| @@ -278,6 +277,66 @@ scoped_ptr<Action::ActionVector> FullStreamUIPolicy::DoReadData(
|
| return actions.Pass();
|
| }
|
|
|
| +void FullStreamUIPolicy::DoRemoveURLs(const std::vector<GURL>& restrict_urls) {
|
| + sql::Connection* db = GetDatabaseConnection();
|
| + if (!db) {
|
| + LOG(ERROR) << "Unable to connect to database";
|
| + return;
|
| + }
|
| +
|
| + // Make sure any queued in memory are sent to the database before cleaning.
|
| + activity_database()->AdviseFlush(ActivityDatabase::kFlushImmediately);
|
| +
|
| + // If no restrictions then then all URLs need to be removed.
|
| + if (restrict_urls.empty()) {
|
| + sql::Statement statement;
|
| + std::string sql_str = base::StringPrintf(
|
| + "UPDATE %s SET page_url=NULL,page_title=NULL,arg_url=NULL",
|
| + kTableName);
|
| + statement.Assign(db->GetCachedStatement(
|
| + sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
|
| +
|
| + if (!statement.Run()) {
|
| + LOG(ERROR) << "Removing URLs from database failed: "
|
| + << statement.GetSQLStatement();
|
| + }
|
| + return;
|
| + }
|
| +
|
| + // If URLs are specified then restrict to only those URLs.
|
| + for (size_t i = 0; i < restrict_urls.size(); ++i) {
|
| + if (!restrict_urls[i].is_valid()) {
|
| + continue;
|
| + }
|
| +
|
| + // Remove any matching page url info.
|
| + sql::Statement statement;
|
| + std::string sql_str = base::StringPrintf(
|
| + "UPDATE %s SET page_url=NULL,page_title=NULL WHERE page_url=?",
|
| + kTableName);
|
| + statement.Assign(db->GetCachedStatement(
|
| + sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
|
| + statement.BindString(0, restrict_urls[i].spec());
|
| +
|
| + if (!statement.Run()) {
|
| + LOG(ERROR) << "Removing page URL from database failed: "
|
| + << statement.GetSQLStatement();
|
| + }
|
| +
|
| + // Remove any matching arg urls.
|
| + sql_str = base::StringPrintf("UPDATE %s SET arg_url=NULL WHERE arg_url=?",
|
| + kTableName);
|
| + statement.Assign(db->GetCachedStatement(
|
| + sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
|
| + statement.BindString(0, restrict_urls[i].spec());
|
| +
|
| + if (!statement.Run()) {
|
| + LOG(ERROR) << "Removing arg URL from database failed: "
|
| + << statement.GetSQLStatement();
|
| + }
|
| + }
|
| +}
|
| +
|
| void FullStreamUIPolicy::OnDatabaseFailure() {
|
| queued_actions_.clear();
|
| }
|
| @@ -328,6 +387,10 @@ void FullStreamUIPolicy::ReadFilteredData(
|
| callback);
|
| }
|
|
|
| +void FullStreamUIPolicy::RemoveURLs(const std::vector<GURL>& restrict_urls) {
|
| + ScheduleAndForget(this, &FullStreamUIPolicy::DoRemoveURLs, restrict_urls);
|
| +}
|
| +
|
| scoped_refptr<Action> FullStreamUIPolicy::ProcessArguments(
|
| scoped_refptr<Action> action) const {
|
| return action;
|
|
|