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 a93cfadd8013e584d51d24ce298afde51b4a3b52..59da18330ab5844ecf40fd5cbef04d0c4e0a239d 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -100,9 +100,11 @@ |
#include "chrome/common/url_constants.h" |
#include "chromeos/chromeos_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" |
@@ -2320,4 +2322,38 @@ crypto::CryptoModuleBlockingPasswordDelegate* |
} |
#endif |
+bool ChromeContentBrowserClient::IsWebRtcLoggingAllowed() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ bool enabled = false; |
+ |
+ // 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)) { |
+ enabled = true; |
+ } else { |
+#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) |
+ } |
+ if (!enabled) |
+ return false; |
+ |
+ return g_browser_process->webrtc_log_uploader()->ApplyForStartLogging(); |
+} |
+ |
+void ChromeContentBrowserClient::UploadWebRtcLog( |
+ scoped_ptr<base::SharedMemory> shared_memory, uint32 length) { |
+ g_browser_process->webrtc_log_uploader()->UploadLog( |
+ shared_memory.Pass(), length); |
+} |
+ |
} // namespace chrome |