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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 const std::string& activity_name, | 431 const std::string& activity_name, |
432 const base::ListValue& args, | 432 const base::ListValue& args, |
433 Action::ActionType type) { | 433 Action::ActionType type) { |
434 ActivityLogState& state = g_activity_log_state.Get(); | 434 ActivityLogState& state = g_activity_log_state.Get(); |
435 if (!state.IsActiveContext(browser_context) || | 435 if (!state.IsActiveContext(browser_context) || |
436 state.IsWhitelistedId(extension_id)) | 436 state.IsWhitelistedId(extension_id)) |
437 return; | 437 return; |
438 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 438 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
439 BrowserThread::PostTask( | 439 BrowserThread::PostTask( |
440 BrowserThread::UI, FROM_HERE, | 440 BrowserThread::UI, FROM_HERE, |
441 base::Bind(&LogApiActivityOnUI, browser_context, extension_id, | 441 base::BindOnce(&LogApiActivityOnUI, browser_context, extension_id, |
442 activity_name, base::Passed(args.CreateDeepCopy()), type)); | 442 activity_name, base::Passed(args.CreateDeepCopy()), |
| 443 type)); |
443 return; | 444 return; |
444 } | 445 } |
445 LogApiActivityOnUI(browser_context, extension_id, activity_name, | 446 LogApiActivityOnUI(browser_context, extension_id, activity_name, |
446 args.CreateDeepCopy(), type); | 447 args.CreateDeepCopy(), type); |
447 } | 448 } |
448 | 449 |
449 // Handler for API events. Thread-safe. | 450 // Handler for API events. Thread-safe. |
450 void LogApiEvent(content::BrowserContext* browser_context, | 451 void LogApiEvent(content::BrowserContext* browser_context, |
451 const std::string& extension_id, | 452 const std::string& extension_id, |
452 const std::string& event_name, | 453 const std::string& event_name, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 bool is_incognito, | 493 bool is_incognito, |
493 const std::string& api_call, | 494 const std::string& api_call, |
494 std::unique_ptr<base::DictionaryValue> details) { | 495 std::unique_ptr<base::DictionaryValue> details) { |
495 ActivityLogState& state = g_activity_log_state.Get(); | 496 ActivityLogState& state = g_activity_log_state.Get(); |
496 if (!state.IsActiveContext(browser_context) || | 497 if (!state.IsActiveContext(browser_context) || |
497 state.IsWhitelistedId(extension_id)) | 498 state.IsWhitelistedId(extension_id)) |
498 return; | 499 return; |
499 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 500 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
500 BrowserThread::PostTask( | 501 BrowserThread::PostTask( |
501 BrowserThread::UI, FROM_HERE, | 502 BrowserThread::UI, FROM_HERE, |
502 base::Bind(&LogWebRequestActivityOnUI, browser_context, extension_id, | 503 base::BindOnce(&LogWebRequestActivityOnUI, browser_context, |
503 url, is_incognito, api_call, base::Passed(&details))); | 504 extension_id, url, is_incognito, api_call, |
| 505 base::Passed(&details))); |
504 return; | 506 return; |
505 } | 507 } |
506 LogWebRequestActivityOnUI(browser_context, extension_id, url, is_incognito, | 508 LogWebRequestActivityOnUI(browser_context, extension_id, url, is_incognito, |
507 api_call, std::move(details)); | 509 api_call, std::move(details)); |
508 } | 510 } |
509 | 511 |
510 void SetActivityHandlers() { | 512 void SetActivityHandlers() { |
511 // Set up event handlers. We don't have to worry about unsetting these, | 513 // Set up event handlers. We don't have to worry about unsetting these, |
512 // because we check whether or not the activity log is active for the context | 514 // because we check whether or not the activity log is active for the context |
513 // in the monitor methods. | 515 // in the monitor methods. |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 } | 939 } |
938 } | 940 } |
939 | 941 |
940 template <> | 942 template <> |
941 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { | 943 void BrowserContextKeyedAPIFactory<ActivityLog>::DeclareFactoryDependencies() { |
942 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 944 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
943 DependsOn(ExtensionRegistryFactory::GetInstance()); | 945 DependsOn(ExtensionRegistryFactory::GetInstance()); |
944 } | 946 } |
945 | 947 |
946 } // namespace extensions | 948 } // namespace extensions |
OLD | NEW |