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/activity_log.h" | 5 #include "chrome/browser/extensions/activity_log/activity_log.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 for (std::set<std::string>::const_iterator it2 = it->second.begin(); | 571 for (std::set<std::string>::const_iterator it2 = it->second.begin(); |
572 it2 != it->second.end(); | 572 it2 != it->second.end(); |
573 ++it2) { | 573 ++it2) { |
574 action->mutable_args()->AppendString(*it2); | 574 action->mutable_args()->AppendString(*it2); |
575 } | 575 } |
576 LogAction(action); | 576 LogAction(action); |
577 } | 577 } |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 void ActivityLog::OnApiEventDispatched(const std::string& extension_id, | 581 void ActivityLog::OnApiEventDispatched( |
582 const std::string& event_name, | 582 const std::string& extension_id, |
583 scoped_ptr<base::ListValue> event_args) { | 583 const std::string& event_name, |
| 584 std::unique_ptr<base::ListValue> event_args) { |
584 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 585 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
585 scoped_refptr<Action> action = new Action(extension_id, | 586 scoped_refptr<Action> action = new Action(extension_id, |
586 base::Time::Now(), | 587 base::Time::Now(), |
587 Action::ACTION_API_EVENT, | 588 Action::ACTION_API_EVENT, |
588 event_name); | 589 event_name); |
589 action->set_args(std::move(event_args)); | 590 action->set_args(std::move(event_args)); |
590 LogAction(action); | 591 LogAction(action); |
591 } | 592 } |
592 | 593 |
593 void ActivityLog::OnApiFunctionCalled(const std::string& extension_id, | 594 void ActivityLog::OnApiFunctionCalled(const std::string& extension_id, |
594 const std::string& api_name, | 595 const std::string& api_name, |
595 scoped_ptr<base::ListValue> args) { | 596 std::unique_ptr<base::ListValue> args) { |
596 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 597 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
597 scoped_refptr<Action> action = new Action(extension_id, | 598 scoped_refptr<Action> action = new Action(extension_id, |
598 base::Time::Now(), | 599 base::Time::Now(), |
599 Action::ACTION_API_CALL, | 600 Action::ACTION_API_CALL, |
600 api_name); | 601 api_name); |
601 action->set_args(std::move(args)); | 602 action->set_args(std::move(args)); |
602 LogAction(action); | 603 LogAction(action); |
603 } | 604 } |
604 | 605 |
605 // LOOKUP ACTIONS. ------------------------------------------------------------- | 606 // LOOKUP ACTIONS. ------------------------------------------------------------- |
606 | 607 |
607 void ActivityLog::GetFilteredActions( | 608 void ActivityLog::GetFilteredActions( |
608 const std::string& extension_id, | 609 const std::string& extension_id, |
609 const Action::ActionType type, | 610 const Action::ActionType type, |
610 const std::string& api_name, | 611 const std::string& api_name, |
611 const std::string& page_url, | 612 const std::string& page_url, |
612 const std::string& arg_url, | 613 const std::string& arg_url, |
613 const int daysAgo, | 614 const int daysAgo, |
614 const base::Callback | 615 const base::Callback< |
615 <void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>& callback) { | 616 void(std::unique_ptr<std::vector<scoped_refptr<Action>>>)>& callback) { |
616 if (database_policy_) { | 617 if (database_policy_) { |
617 database_policy_->ReadFilteredData( | 618 database_policy_->ReadFilteredData( |
618 extension_id, type, api_name, page_url, arg_url, daysAgo, callback); | 619 extension_id, type, api_name, page_url, arg_url, daysAgo, callback); |
619 } | 620 } |
620 } | 621 } |
621 | 622 |
622 // DELETE ACTIONS. ------------------------------------------------------------- | 623 // DELETE ACTIONS. ------------------------------------------------------------- |
623 | 624 |
624 void ActivityLog::RemoveActions(const std::vector<int64_t>& action_ids) { | 625 void ActivityLog::RemoveActions(const std::vector<int64_t>& action_ids) { |
625 if (!database_policy_) | 626 if (!database_policy_) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 database_policy_->DeleteDatabase(); | 660 database_policy_->DeleteDatabase(); |
660 } | 661 } |
661 | 662 |
662 template <> | 663 template <> |
663 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { | 664 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { |
664 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 665 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
665 DependsOn(ExtensionRegistryFactory::GetInstance()); | 666 DependsOn(ExtensionRegistryFactory::GetInstance()); |
666 } | 667 } |
667 | 668 |
668 } // namespace extensions | 669 } // namespace extensions |
OLD | NEW |