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

Unified Diff: chrome/browser/tracing/chrome_tracing_delegate.cc

Issue 2006973002: Background tracing: Enable field-trial control on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tracing/chrome_tracing_delegate.cc
diff --git a/chrome/browser/tracing/chrome_tracing_delegate.cc b/chrome/browser/tracing/chrome_tracing_delegate.cc
index 9f90148870942d150b1d49f471c80bd8f0679ca3..9ab212e731ec74e9ecf9d930ae855a0dc038bbb5 100644
--- a/chrome/browser/tracing/chrome_tracing_delegate.cc
+++ b/chrome/browser/tracing/chrome_tracing_delegate.cc
@@ -36,17 +36,23 @@ void ChromeTracingDelegate::RegisterPrefs(PrefRegistrySimple* registry) {
ChromeTracingDelegate::ChromeTracingDelegate() : incognito_launched_(false) {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+#if !defined(OS_ANDROID)
BrowserList::AddObserver(this);
+#endif
}
ChromeTracingDelegate::~ChromeTracingDelegate() {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+#if !defined(OS_ANDROID)
BrowserList::RemoveObserver(this);
+#endif
}
void ChromeTracingDelegate::OnBrowserAdded(Browser* browser) {
+#if !defined(OS_ANDROID)
if (browser->profile()->IsOffTheRecord())
incognito_launched_ = true;
+#endif
}
std::unique_ptr<content::TraceUploader> ChromeTracingDelegate::GetTraceUploader(
@@ -110,6 +116,12 @@ bool ProfileAllowsScenario(const content::BackgroundTracingConfig& config,
bool ChromeTracingDelegate::IsAllowedToBeginBackgroundScenario(
const content::BackgroundTracingConfig& config,
bool requires_anonymized_data) {
+#if defined(OS_ANDROID)
+ // TODO(oysteine): Support preemptive mode safely in Android.
+ if (config.tracing_mode() == content::BackgroundTracingConfig::PREEMPTIVE)
+ return false;
+#endif
+
if (!ProfileAllowsScenario(config, PROFILE_NOT_REQUIRED))
return false;
@@ -122,8 +134,10 @@ bool ChromeTracingDelegate::IsAllowedToBeginBackgroundScenario(
bool ChromeTracingDelegate::IsAllowedToEndBackgroundScenario(
const content::BackgroundTracingConfig& config,
bool requires_anonymized_data) {
- if (requires_anonymized_data && incognito_launched_)
+ if (requires_anonymized_data &&
+ (incognito_launched_ || chrome::IsOffTheRecordSessionActive())) {
return false;
+ }
if (!ProfileAllowsScenario(config, PROFILE_REQUIRED))
return false;
« no previous file with comments | « chrome/browser/prefs/browser_prefs.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698