Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5627)

Unified Diff: chrome/browser/extensions/activity_log/activity_log.cc

Issue 2089333002: [Extensions] Add renderer-side logic to short circuit activity logging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/activity_log/activity_log.cc
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index c7ac3ca62234cef2e5b77e7b79711270972b918d..17b8be0030e51bce2bd18453db9ee427219643e7 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -35,6 +35,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/api_activity_monitor.h"
#include "extensions/browser/extension_registry.h"
@@ -43,6 +44,7 @@
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_messages.h"
#include "extensions/common/one_shot_event.h"
#include "third_party/re2/src/re2/re2.h"
#include "url/gurl.h"
@@ -839,6 +841,8 @@ void ActivityLog::CheckActive() {
content::BrowserContext* off_the_record =
profile_->HasOffTheRecordProfile() ? profile_->GetOffTheRecordProfile()
: nullptr;
+
+ bool old_is_active = is_active_;
if (has_db || IsWatchdogAppActive()) {
if (is_active_)
return; // Already enabled.
@@ -857,6 +861,18 @@ void ActivityLog::CheckActive() {
registrar_.RemoveAll();
is_active_ = false;
}
+
+ if (old_is_active != is_active_) {
+ for (content::RenderProcessHost::iterator iter(
+ content::RenderProcessHost::AllHostsIterator());
+ !iter.IsAtEnd(); iter.Advance()) {
+ content::RenderProcessHost* host = iter.GetCurrentValue();
+ if (profile_->IsSameProfile(
+ Profile::FromBrowserContext(host->GetBrowserContext()))) {
+ host->Send(new ExtensionMsg_SetActivityLoggingEnabled(is_active_));
+ }
+ }
+ }
}
void ActivityLog::Observe(int type,

Powered by Google App Engine
This is Rietveld 408576698