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

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: Added a TODO 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 DISALLOW_COPY_AND_ASSIGN(CastGeolocationDelegate);
100 };
101
86 } // namespace 102 } // namespace
87 103
88 CastContentBrowserClient::CastContentBrowserClient() 104 CastContentBrowserClient::CastContentBrowserClient()
89 : cast_browser_main_parts_(nullptr), 105 : cast_browser_main_parts_(nullptr),
90 url_request_context_factory_(new URLRequestContextFactory()) {} 106 url_request_context_factory_(new URLRequestContextFactory()) {}
91 107
92 CastContentBrowserClient::~CastContentBrowserClient() { 108 CastContentBrowserClient::~CastContentBrowserClient() {
93 content::BrowserThread::DeleteSoon( 109 content::BrowserThread::DeleteSoon(
94 content::BrowserThread::IO, 110 content::BrowserThread::IO,
95 FROM_HERE, 111 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 269 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas
254 // apps. 270 // apps.
255 if (process_type == switches::kGpuProcess) { 271 if (process_type == switches::kGpuProcess) {
256 command_line->AppendSwitch(switches::kGpuNoContextLost); 272 command_line->AppendSwitch(switches::kGpuNoContextLost);
257 } 273 }
258 #endif 274 #endif
259 275
260 AppendExtraCommandLineSwitches(command_line); 276 AppendExtraCommandLineSwitches(command_line);
261 } 277 }
262 278
263 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { 279 content::GeolocationProvider::Delegate*
264 return new CastAccessTokenStore( 280 CastContentBrowserClient::CreateGeolocationDelegate() {
281 return new CastGeolocationDelegate(
265 CastBrowserProcess::GetInstance()->browser_context()); 282 CastBrowserProcess::GetInstance()->browser_context());
266 } 283 }
267 284
268 void CastContentBrowserClient::OverrideWebkitPrefs( 285 void CastContentBrowserClient::OverrideWebkitPrefs(
269 content::RenderViewHost* render_view_host, 286 content::RenderViewHost* render_view_host,
270 content::WebPreferences* prefs) { 287 content::WebPreferences* prefs) {
271 prefs->allow_scripts_to_close_windows = true; 288 prefs->allow_scripts_to_close_windows = true;
272 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default 289 // 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 290 // 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 291 // 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 */); 534 process_type, dumps_path, false /* upload */);
518 // StartUploaderThread() even though upload is diferred. 535 // StartUploaderThread() even though upload is diferred.
519 // Breakpad-related memory is freed in the uploader thread. 536 // Breakpad-related memory is freed in the uploader thread.
520 crash_handler->StartUploaderThread(); 537 crash_handler->StartUploaderThread();
521 return crash_handler; 538 return crash_handler;
522 } 539 }
523 #endif // !defined(OS_ANDROID) 540 #endif // !defined(OS_ANDROID)
524 541
525 } // namespace shell 542 } // namespace shell
526 } // namespace chromecast 543 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/cast_content_browser_client.h ('k') | content/browser/geolocation/geolocation_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698