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

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: Changing to ContentBrowserClient::GetGeolocationServiceOverrides and impl'd in the 6 impl's. Unitte… Created 4 years, 6 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 CastGeolocationServiceOverrides
89 : public content::GeolocationProvider::ServiceOverrides {
90 public:
91 explicit CastGeolocationServiceOverrides(CastBrowserContext* context)
92 : context_(context) {}
93 AccessTokenStore* CreateAccessTokenStore() override {
94 return new CastAccessTokenStore(context_);
95 }
96
97 private:
98 CastBrowserContext* context_;
99 };
100
86 } // namespace 101 } // namespace
87 102
88 CastContentBrowserClient::CastContentBrowserClient() 103 CastContentBrowserClient::CastContentBrowserClient()
89 : cast_browser_main_parts_(nullptr), 104 : cast_browser_main_parts_(nullptr),
90 url_request_context_factory_(new URLRequestContextFactory()) {} 105 url_request_context_factory_(new URLRequestContextFactory()) {}
91 106
92 CastContentBrowserClient::~CastContentBrowserClient() { 107 CastContentBrowserClient::~CastContentBrowserClient() {
93 content::BrowserThread::DeleteSoon( 108 content::BrowserThread::DeleteSoon(
94 content::BrowserThread::IO, 109 content::BrowserThread::IO,
95 FROM_HERE, 110 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 268 // GLES2 contexts can be lost to a power-save mode, which breaks GPU canvas
254 // apps. 269 // apps.
255 if (process_type == switches::kGpuProcess) { 270 if (process_type == switches::kGpuProcess) {
256 command_line->AppendSwitch(switches::kGpuNoContextLost); 271 command_line->AppendSwitch(switches::kGpuNoContextLost);
257 } 272 }
258 #endif 273 #endif
259 274
260 AppendExtraCommandLineSwitches(command_line); 275 AppendExtraCommandLineSwitches(command_line);
261 } 276 }
262 277
263 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { 278 GeolocationProvider::ServiceOverrides*
264 return new CastAccessTokenStore( 279 CastContentBrowserClient::GetGeolocationServiceOverrides() {
280 return new CastGeolocationServiceOverrides(
265 CastBrowserProcess::GetInstance()->browser_context()); 281 CastBrowserProcess::GetInstance()->browser_context());
266 } 282 }
267 283
268 void CastContentBrowserClient::OverrideWebkitPrefs( 284 void CastContentBrowserClient::OverrideWebkitPrefs(
269 content::RenderViewHost* render_view_host, 285 content::RenderViewHost* render_view_host,
270 content::WebPreferences* prefs) { 286 content::WebPreferences* prefs) {
271 prefs->allow_scripts_to_close_windows = true; 287 prefs->allow_scripts_to_close_windows = true;
272 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default 288 // 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 289 // 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 290 // 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 */); 533 process_type, dumps_path, false /* upload */);
518 // StartUploaderThread() even though upload is diferred. 534 // StartUploaderThread() even though upload is diferred.
519 // Breakpad-related memory is freed in the uploader thread. 535 // Breakpad-related memory is freed in the uploader thread.
520 crash_handler->StartUploaderThread(); 536 crash_handler->StartUploaderThread();
521 return crash_handler; 537 return crash_handler;
522 } 538 }
523 #endif // !defined(OS_ANDROID) 539 #endif // !defined(OS_ANDROID)
524 540
525 } // namespace shell 541 } // namespace shell
526 } // namespace chromecast 542 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698