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

Side by Side Diff: chromecast/browser/cast_content_browser_client.cc

Issue 2098553002: Geolocation: extract ContentBrowserClient methods specific to Geolocation into a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Minor touch in LocationArbitratorImplTest to restate previous behaviour. Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/browser/cast_content_browser_client.h" 5 #include "chromecast/browser/cast_content_browser_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 new media::CastMojoMediaClient( 76 new media::CastMojoMediaClient(
77 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend, 77 base::Bind(&CastContentBrowserClient::CreateMediaPipelineBackend,
78 base::Unretained(browser_client)), 78 base::Unretained(browser_client)),
79 base::Bind(&CastContentBrowserClient::CreateCdmFactory, 79 base::Bind(&CastContentBrowserClient::CreateCdmFactory,
80 base::Unretained(browser_client)))); 80 base::Unretained(browser_client))));
81 return std::unique_ptr<::shell::ShellClient>( 81 return std::unique_ptr<::shell::ShellClient>(
82 new ::media::MojoMediaApplication(std::move(mojo_media_client), 82 new ::media::MojoMediaApplication(std::move(mojo_media_client),
83 quit_closure)); 83 quit_closure));
84 } 84 }
85 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) 85 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
86
87 // A provider of services for Geolocation.
88 class CastGeolocationDelegate : public content::GeolocationProvider::Delegate {
89 public:
90 explicit CastGeolocationDelegate(CastBrowserContext* context)
91 : context_(context) {}
92 content::AccessTokenStore* CreateAccessTokenStore() override {
93 return new CastAccessTokenStore(context_);
94 }
95
96 private:
97 CastBrowserContext* context_;
98 };
99
86 } // namespace 100 } // namespace
87 101
88 CastContentBrowserClient::CastContentBrowserClient() 102 CastContentBrowserClient::CastContentBrowserClient()
89 : cast_browser_main_parts_(nullptr), 103 : cast_browser_main_parts_(nullptr),
90 url_request_context_factory_(new URLRequestContextFactory()) {} 104 url_request_context_factory_(new URLRequestContextFactory()) {}
91 105
92 CastContentBrowserClient::~CastContentBrowserClient() { 106 CastContentBrowserClient::~CastContentBrowserClient() {
93 content::BrowserThread::DeleteSoon( 107 content::BrowserThread::DeleteSoon(
94 content::BrowserThread::IO, 108 content::BrowserThread::IO,
95 FROM_HERE, 109 FROM_HERE,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas 267 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas
254 // apps. 268 // apps.
255 if (process_type == switches::kGpuProcess) { 269 if (process_type == switches::kGpuProcess) {
256 command_line->AppendSwitch(switches::kGpuNoContextLost); 270 command_line->AppendSwitch(switches::kGpuNoContextLost);
257 } 271 }
258 #endif 272 #endif
259 273
260 AppendExtraCommandLineSwitches(command_line); 274 AppendExtraCommandLineSwitches(command_line);
261 } 275 }
262 276
263 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { 277 content::GeolocationProvider::Delegate*
264 return new CastAccessTokenStore( 278 CastContentBrowserClient::CreateGeolocationDelegate() {
279 return new CastGeolocationDelegate(
265 CastBrowserProcess::GetInstance()->browser_context()); 280 CastBrowserProcess::GetInstance()->browser_context());
266 } 281 }
267 282
268 void CastContentBrowserClient::OverrideWebkitPrefs( 283 void CastContentBrowserClient::OverrideWebkitPrefs(
269 content::RenderViewHost* render_view_host, 284 content::RenderViewHost* render_view_host,
270 content::WebPreferences* prefs) { 285 content::WebPreferences* prefs) {
271 prefs->allow_scripts_to_close_windows = true; 286 prefs->allow_scripts_to_close_windows = true;
272 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default 287 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default
273 // because some content providers such as YouTube use plain http requests 288 // because some content providers such as YouTube use plain http requests
274 // to retrieve media data chunks while running in a https page. This pref 289 // to retrieve media data chunks while running in a https page. This pref
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 process_type, dumps_path, false /* upload */); 532 process_type, dumps_path, false /* upload */);
518 // StartUploaderThread() even though upload is diferred. 533 // StartUploaderThread() even though upload is diferred.
519 // Breakpad-related memory is freed in the uploader thread. 534 // Breakpad-related memory is freed in the uploader thread.
520 crash_handler->StartUploaderThread(); 535 crash_handler->StartUploaderThread();
521 return crash_handler; 536 return crash_handler;
522 } 537 }
523 #endif // !defined(OS_ANDROID) 538 #endif // !defined(OS_ANDROID)
524 539
525 } // namespace shell 540 } // namespace shell
526 } // namespace chromecast 541 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698