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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Execute the query and get results. | 188 // Execute the query and get results. |
189 while (query.is_valid() && query.Step()) { | 189 while (query.is_valid() && query.Step()) { |
190 scoped_refptr<Action> action = | 190 scoped_refptr<Action> action = |
191 new Action(query.ColumnString(0), | 191 new Action(query.ColumnString(0), |
192 base::Time::FromInternalValue(query.ColumnInt64(1)), | 192 base::Time::FromInternalValue(query.ColumnInt64(1)), |
193 static_cast<Action::ActionType>(query.ColumnInt(2)), | 193 static_cast<Action::ActionType>(query.ColumnInt(2)), |
194 query.ColumnString(3)); | 194 query.ColumnString(3)); |
195 | 195 |
196 if (query.ColumnType(4) != sql::COLUMN_TYPE_NULL) { | 196 if (query.ColumnType(4) != sql::COLUMN_TYPE_NULL) { |
197 scoped_ptr<Value> parsed_value( | 197 scoped_ptr<base::Value> parsed_value( |
198 base::JSONReader::Read(query.ColumnString(4))); | 198 base::JSONReader::Read(query.ColumnString(4))); |
199 if (parsed_value && parsed_value->IsType(Value::TYPE_LIST)) { | 199 if (parsed_value && parsed_value->IsType(base::Value::TYPE_LIST)) { |
200 action->set_args( | 200 action->set_args(make_scoped_ptr( |
201 make_scoped_ptr(static_cast<ListValue*>(parsed_value.release()))); | 201 static_cast<base::ListValue*>(parsed_value.release()))); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 action->ParsePageUrl(query.ColumnString(5)); | 205 action->ParsePageUrl(query.ColumnString(5)); |
206 action->set_page_title(query.ColumnString(6)); | 206 action->set_page_title(query.ColumnString(6)); |
207 action->ParseArgUrl(query.ColumnString(7)); | 207 action->ParseArgUrl(query.ColumnString(7)); |
208 | 208 |
209 if (query.ColumnType(8) != sql::COLUMN_TYPE_NULL) { | 209 if (query.ColumnType(8) != sql::COLUMN_TYPE_NULL) { |
210 scoped_ptr<Value> parsed_value( | 210 scoped_ptr<base::Value> parsed_value( |
211 base::JSONReader::Read(query.ColumnString(8))); | 211 base::JSONReader::Read(query.ColumnString(8))); |
212 if (parsed_value && parsed_value->IsType(Value::TYPE_DICTIONARY)) { | 212 if (parsed_value && parsed_value->IsType(base::Value::TYPE_DICTIONARY)) { |
213 action->set_other(make_scoped_ptr( | 213 action->set_other(make_scoped_ptr( |
214 static_cast<DictionaryValue*>(parsed_value.release()))); | 214 static_cast<base::DictionaryValue*>(parsed_value.release()))); |
215 } | 215 } |
216 } | 216 } |
217 actions->push_back(action); | 217 actions->push_back(action); |
218 } | 218 } |
219 | 219 |
220 return actions.Pass(); | 220 return actions.Pass(); |
221 } | 221 } |
222 | 222 |
223 void FullStreamUIPolicy::DoRemoveURLs(const std::vector<GURL>& restrict_urls) { | 223 void FullStreamUIPolicy::DoRemoveURLs(const std::vector<GURL>& restrict_urls) { |
224 sql::Connection* db = GetDatabaseConnection(); | 224 sql::Connection* db = GetDatabaseConnection(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 402 } |
403 | 403 |
404 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { | 404 void FullStreamUIPolicy::QueueAction(scoped_refptr<Action> action) { |
405 if (activity_database()->is_db_valid()) { | 405 if (activity_database()->is_db_valid()) { |
406 queued_actions_.push_back(action); | 406 queued_actions_.push_back(action); |
407 activity_database()->AdviseFlush(queued_actions_.size()); | 407 activity_database()->AdviseFlush(queued_actions_.size()); |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 } // namespace extensions | 411 } // namespace extensions |
OLD | NEW |