Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index d893e3c0f3fd08137142f812cf9b2ba4a701c634..bb4dafd07921bc1f29ce9e636281d879c33166df 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -99,9 +99,11 @@ |
#include "chrome/common/render_messages.h" |
#include "chrome/common/url_constants.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
+#include "components/webrtc_log_uploader/webrtc_log_uploader.h" |
#include "content/public/browser/browser_child_process_host.h" |
#include "content/public/browser/browser_main_parts.h" |
#include "content/public/browser/browser_ppapi_host.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/browser_url_handler.h" |
#include "content/public/browser/child_process_data.h" |
#include "content/public/browser/child_process_security_policy.h" |
@@ -2279,4 +2281,37 @@ crypto::CryptoModuleBlockingPasswordDelegate* |
} |
#endif |
+bool ChromeContentBrowserClient::IsWebRtcLoggingAllowed() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ // If the user permits metrics reporting / crash uploading with the checkbox |
+ // in the prefs, we allow uploading automatically. We disable uploading |
+ // completely for non-official builds. This can be forced with a flag. |
+ const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(switches::kEnableMetricsReportingForTesting)) |
+ return true; |
+ |
+ bool enabled = false; |
+ |
+#if defined(GOOGLE_CHROME_BUILD) |
+#if defined(OS_CHROMEOS) |
+ chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
+ &enabled); |
+#else |
+ enabled = g_browser_process->local_state()->GetBoolean( |
+ prefs::kMetricsReportingEnabled); |
+#endif // #if defined(OS_CHROMEOS) |
+#endif // defined(GOOGLE_CHROME_BUILD) |
+ |
+ // TODO(grunell): Limit to max 5 logs open simultaneosly. The uploader can |
+ // keep track of that. |
+ |
+ return enabled; |
+} |
+ |
+void ChromeContentBrowserClient::UploadWebRtcLog( |
+ base::SharedMemory* shared_memory, uint32 length) { |
+ g_browser_process->webrtc_log_uploader()->UploadLog(shared_memory, length); |
+} |
+ |
} // namespace chrome |