| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/extensions/activity_log.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 args, | 354 args, |
| 355 extra, | 355 extra, |
| 356 DOMAction::MODIFIED); | 356 DOMAction::MODIFIED); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void ActivityLog::GetActions( | 359 void ActivityLog::GetActions( |
| 360 const std::string& extension_id, | 360 const std::string& extension_id, |
| 361 const int day, | 361 const int day, |
| 362 const base::Callback | 362 const base::Callback |
| 363 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) { | 363 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) { |
| 364 if (!db_.get()) return; | 364 if (!db_) return; |
| 365 BrowserThread::PostTaskAndReplyWithResult( | 365 BrowserThread::PostTaskAndReplyWithResult( |
| 366 BrowserThread::DB, | 366 BrowserThread::DB, |
| 367 FROM_HERE, | 367 FROM_HERE, |
| 368 base::Bind(&ActivityDatabase::GetActions, | 368 base::Bind(&ActivityDatabase::GetActions, |
| 369 db_.get(), | 369 db_.get(), |
| 370 extension_id, | 370 extension_id, |
| 371 day), | 371 day), |
| 372 callback); | 372 callback); |
| 373 } | 373 } |
| 374 | 374 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 web_contents->GetTitle(), | 408 web_contents->GetTitle(), |
| 409 std::string(), // no api call here | 409 std::string(), // no api call here |
| 410 script_names.get(), | 410 script_names.get(), |
| 411 std::string(), // no extras either | 411 std::string(), // no extras either |
| 412 DOMAction::INSERTED); | 412 DOMAction::INSERTED); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 void ActivityLog::KillActivityLogDatabase() { | 417 void ActivityLog::KillActivityLogDatabase() { |
| 418 if (db_.get()) { | 418 if (db_) { |
| 419 ScheduleAndForget(&ActivityDatabase::KillDatabase); | 419 ScheduleAndForget(&ActivityDatabase::KillDatabase); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 // static | 423 // static |
| 424 const char* ActivityLog::ActivityToString(Activity activity) { | 424 const char* ActivityLog::ActivityToString(Activity activity) { |
| 425 switch (activity) { | 425 switch (activity) { |
| 426 case ActivityLog::ACTIVITY_EXTENSION_API_CALL: | 426 case ActivityLog::ACTIVITY_EXTENSION_API_CALL: |
| 427 return "api_call"; | 427 return "api_call"; |
| 428 case ActivityLog::ACTIVITY_EXTENSION_API_BLOCK: | 428 case ActivityLog::ACTIVITY_EXTENSION_API_BLOCK: |
| 429 return "api_block"; | 429 return "api_block"; |
| 430 case ActivityLog::ACTIVITY_CONTENT_SCRIPT: | 430 case ActivityLog::ACTIVITY_CONTENT_SCRIPT: |
| 431 return "content_script"; | 431 return "content_script"; |
| 432 case ActivityLog::ACTIVITY_EVENT_DISPATCH: | 432 case ActivityLog::ACTIVITY_EVENT_DISPATCH: |
| 433 return "event_dispatch"; | 433 return "event_dispatch"; |
| 434 default: | 434 default: |
| 435 NOTREACHED(); | 435 NOTREACHED(); |
| 436 return ""; | 436 return ""; |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace extensions | 440 } // namespace extensions |
| OLD | NEW |