| 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 | |
| 9 #include <set> | 8 #include <set> |
| 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/json/json_string_value_serializer.h" | 13 #include "base/json/json_string_value_serializer.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 579 } |
| 580 | 580 |
| 581 void ActivityLog::OnApiEventDispatched(const std::string& extension_id, | 581 void ActivityLog::OnApiEventDispatched(const std::string& extension_id, |
| 582 const std::string& event_name, | 582 const std::string& event_name, |
| 583 scoped_ptr<base::ListValue> event_args) { | 583 scoped_ptr<base::ListValue> event_args) { |
| 584 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 584 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 585 scoped_refptr<Action> action = new Action(extension_id, | 585 scoped_refptr<Action> action = new Action(extension_id, |
| 586 base::Time::Now(), | 586 base::Time::Now(), |
| 587 Action::ACTION_API_EVENT, | 587 Action::ACTION_API_EVENT, |
| 588 event_name); | 588 event_name); |
| 589 action->set_args(event_args.Pass()); | 589 action->set_args(std::move(event_args)); |
| 590 LogAction(action); | 590 LogAction(action); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void ActivityLog::OnApiFunctionCalled(const std::string& extension_id, | 593 void ActivityLog::OnApiFunctionCalled(const std::string& extension_id, |
| 594 const std::string& api_name, | 594 const std::string& api_name, |
| 595 scoped_ptr<base::ListValue> args) { | 595 scoped_ptr<base::ListValue> args) { |
| 596 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 596 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 597 scoped_refptr<Action> action = new Action(extension_id, | 597 scoped_refptr<Action> action = new Action(extension_id, |
| 598 base::Time::Now(), | 598 base::Time::Now(), |
| 599 Action::ACTION_API_CALL, | 599 Action::ACTION_API_CALL, |
| 600 api_name); | 600 api_name); |
| 601 action->set_args(args.Pass()); | 601 action->set_args(std::move(args)); |
| 602 LogAction(action); | 602 LogAction(action); |
| 603 } | 603 } |
| 604 | 604 |
| 605 // LOOKUP ACTIONS. ------------------------------------------------------------- | 605 // LOOKUP ACTIONS. ------------------------------------------------------------- |
| 606 | 606 |
| 607 void ActivityLog::GetFilteredActions( | 607 void ActivityLog::GetFilteredActions( |
| 608 const std::string& extension_id, | 608 const std::string& extension_id, |
| 609 const Action::ActionType type, | 609 const Action::ActionType type, |
| 610 const std::string& api_name, | 610 const std::string& api_name, |
| 611 const std::string& page_url, | 611 const std::string& page_url, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 database_policy_->DeleteDatabase(); | 659 database_policy_->DeleteDatabase(); |
| 660 } | 660 } |
| 661 | 661 |
| 662 template <> | 662 template <> |
| 663 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { | 663 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { |
| 664 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 664 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 665 DependsOn(ExtensionRegistryFactory::GetInstance()); | 665 DependsOn(ExtensionRegistryFactory::GetInstance()); |
| 666 } | 666 } |
| 667 | 667 |
| 668 } // namespace extensions | 668 } // namespace extensions |
| OLD | NEW |