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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 14329020: Implementing uploading of a WebRTC diagnostic log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review, added url and app session id, rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "chrome/common/extensions/permissions/socket_permission.h" 98 #include "chrome/common/extensions/permissions/socket_permission.h"
99 #include "chrome/common/logging_chrome.h" 99 #include "chrome/common/logging_chrome.h"
100 #include "chrome/common/pref_names.h" 100 #include "chrome/common/pref_names.h"
101 #include "chrome/common/render_messages.h" 101 #include "chrome/common/render_messages.h"
102 #include "chrome/common/url_constants.h" 102 #include "chrome/common/url_constants.h"
103 #include "chromeos/chromeos_constants.h" 103 #include "chromeos/chromeos_constants.h"
104 #include "components/user_prefs/pref_registry_syncable.h" 104 #include "components/user_prefs/pref_registry_syncable.h"
105 #include "content/public/browser/browser_child_process_host.h" 105 #include "content/public/browser/browser_child_process_host.h"
106 #include "content/public/browser/browser_main_parts.h" 106 #include "content/public/browser/browser_main_parts.h"
107 #include "content/public/browser/browser_ppapi_host.h" 107 #include "content/public/browser/browser_ppapi_host.h"
108 #include "content/public/browser/browser_thread.h"
108 #include "content/public/browser/browser_url_handler.h" 109 #include "content/public/browser/browser_url_handler.h"
109 #include "content/public/browser/child_process_data.h" 110 #include "content/public/browser/child_process_data.h"
110 #include "content/public/browser/child_process_security_policy.h" 111 #include "content/public/browser/child_process_security_policy.h"
111 #include "content/public/browser/compositor_util.h" 112 #include "content/public/browser/compositor_util.h"
112 #include "content/public/browser/render_process_host.h" 113 #include "content/public/browser/render_process_host.h"
113 #include "content/public/browser/render_view_host.h" 114 #include "content/public/browser/render_view_host.h"
114 #include "content/public/browser/resource_context.h" 115 #include "content/public/browser/resource_context.h"
115 #include "content/public/browser/site_instance.h" 116 #include "content/public/browser/site_instance.h"
116 #include "content/public/browser/web_contents.h" 117 #include "content/public/browser/web_contents.h"
117 #include "content/public/browser/web_contents_view.h" 118 #include "content/public/browser/web_contents_view.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 175
175 #if !defined(OS_CHROMEOS) 176 #if !defined(OS_CHROMEOS)
176 #include "chrome/browser/signin/signin_manager.h" 177 #include "chrome/browser/signin/signin_manager.h"
177 #include "chrome/browser/signin/signin_manager_factory.h" 178 #include "chrome/browser/signin/signin_manager_factory.h"
178 #endif 179 #endif
179 180
180 #if !defined(OS_ANDROID) 181 #if !defined(OS_ANDROID)
181 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p rovider.h" 182 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p rovider.h"
182 #endif 183 #endif
183 184
185 #if defined(ENABLE_WEBRTC)
186 #include "components/webrtc_log_uploader/webrtc_log_uploader.h"
187 #endif
188
184 using base::FileDescriptor; 189 using base::FileDescriptor;
185 using content::AccessTokenStore; 190 using content::AccessTokenStore;
186 using content::BrowserChildProcessHostIterator; 191 using content::BrowserChildProcessHostIterator;
187 using content::BrowserThread; 192 using content::BrowserThread;
188 using content::BrowserURLHandler; 193 using content::BrowserURLHandler;
189 using content::ChildProcessSecurityPolicy; 194 using content::ChildProcessSecurityPolicy;
190 using content::FileDescriptorInfo; 195 using content::FileDescriptorInfo;
191 using content::QuotaPermissionContext; 196 using content::QuotaPermissionContext;
192 using content::RenderViewHost; 197 using content::RenderViewHost;
193 using content::SiteInstance; 198 using content::SiteInstance;
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 2329
2325 #if defined(USE_NSS) 2330 #if defined(USE_NSS)
2326 crypto::CryptoModuleBlockingPasswordDelegate* 2331 crypto::CryptoModuleBlockingPasswordDelegate*
2327 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 2332 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
2328 const GURL& url) { 2333 const GURL& url) {
2329 return chrome::NewCryptoModuleBlockingDialogDelegate( 2334 return chrome::NewCryptoModuleBlockingDialogDelegate(
2330 chrome::kCryptoModulePasswordKeygen, url.host()); 2335 chrome::kCryptoModulePasswordKeygen, url.host());
2331 } 2336 }
2332 #endif 2337 #endif
2333 2338
2339 #if defined(ENABLE_WEBRTC)
2340 bool ChromeContentBrowserClient::IsWebRtcLoggingAllowed() {
2341 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2342
2343 bool enabled = false;
2344
2345 // If the user permits metrics reporting / crash uploading with the checkbox
2346 // in the prefs, we allow uploading automatically. We disable uploading
2347 // completely for non-official builds.
2348 #if defined(GOOGLE_CHROME_BUILD)
2349 #if defined(OS_CHROMEOS)
2350 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
2351 &enabled);
2352 #else
2353 enabled = g_browser_process->local_state()->GetBoolean(
2354 prefs::kMetricsReportingEnabled);
2355 #endif // #if defined(OS_CHROMEOS)
2356 #endif // defined(GOOGLE_CHROME_BUILD)
2357 if (!enabled)
2358 return false;
2359
2360 return g_browser_process->webrtc_log_uploader()->ApplyForStartLogging();
2361 }
2362
2363 void ChromeContentBrowserClient::UploadWebRtcLog(
2364 content::BrowserContext* browser_context,
2365 scoped_ptr<base::SharedMemory> shared_memory, uint32 length,
2366 const std::string& app_session_id, const std::string& app_url) {
2367 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2368
2369 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
2370 &components::WebRtcLogUploader::UploadLog,
2371 base::Unretained(g_browser_process->webrtc_log_uploader()),
2372 base::Unretained(browser_context->GetRequestContext()),
2373 Passed(&shared_memory),
2374 length,
2375 app_session_id,
2376 app_url));
2377 }
2378 #endif // defined(ENABLE_WEBRTC)
2379
2334 } // namespace chrome 2380 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698