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

Side by Side Diff: chromecast/browser/service/cast_service_simple.cc

Issue 853073003: Fix assertion starting cast_shell (breaking thread IO restrictions). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitespace fixes plus task is not slow Created 5 years, 11 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/service/cast_service_simple.h" 5 #include "chromecast/browser/service/cast_service_simple.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chromecast/browser/cast_content_window.h" 8 #include "chromecast/browser/cast_content_window.h"
9 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "net/base/filename_util.h" 11 #include "net/base/filename_util.h"
12 #include "net/url_request/url_request_context_getter.h" 12 #include "net/url_request/url_request_context_getter.h"
13 #include "url/gurl.h"
14 13
15 namespace chromecast { 14 namespace chromecast {
16 15
17 namespace { 16 namespace {
18 17
19 GURL GetStartupURL() { 18 GURL GetStartupURL() {
20 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 19 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
21 const base::CommandLine::StringVector& args = command_line->GetArgs(); 20 const base::CommandLine::StringVector& args = command_line->GetArgs();
22 21
23 if (args.empty()) 22 if (args.empty())
(...skipping 23 matching lines...) Expand all
47 content::BrowserContext* browser_context, 46 content::BrowserContext* browser_context,
48 PrefService* pref_service, 47 PrefService* pref_service,
49 metrics::CastMetricsServiceClient* metrics_service_client) 48 metrics::CastMetricsServiceClient* metrics_service_client)
50 : CastService(browser_context, pref_service, metrics_service_client) { 49 : CastService(browser_context, pref_service, metrics_service_client) {
51 } 50 }
52 51
53 CastServiceSimple::~CastServiceSimple() { 52 CastServiceSimple::~CastServiceSimple() {
54 } 53 }
55 54
56 void CastServiceSimple::InitializeInternal() { 55 void CastServiceSimple::InitializeInternal() {
56 startup_url_ = GetStartupURL();
57 } 57 }
58 58
59 void CastServiceSimple::FinalizeInternal() { 59 void CastServiceSimple::FinalizeInternal() {
60 } 60 }
61 61
62 void CastServiceSimple::StartInternal() { 62 void CastServiceSimple::StartInternal() {
63 // This is the simple version that hard-codes the size. 63 // This is the simple version that hard-codes the size.
64 gfx::Size initial_size(1280, 720); 64 gfx::Size initial_size(1280, 720);
65 65
66 window_.reset(new CastContentWindow); 66 window_.reset(new CastContentWindow);
67 web_contents_ = window_->CreateWebContents(initial_size, browser_context()); 67 web_contents_ = window_->CreateWebContents(initial_size, browser_context());
68 window_->CreateWindowTree(initial_size, web_contents_.get()); 68 window_->CreateWindowTree(initial_size, web_contents_.get());
69 69
70 web_contents_->GetController().LoadURL(GetStartupURL(), 70 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(),
71 content::Referrer(),
72 ui::PAGE_TRANSITION_TYPED, 71 ui::PAGE_TRANSITION_TYPED,
73 std::string()); 72 std::string());
74 } 73 }
75 74
76 void CastServiceSimple::StopInternal() { 75 void CastServiceSimple::StopInternal() {
77 web_contents_->GetRenderViewHost()->ClosePage(); 76 web_contents_->GetRenderViewHost()->ClosePage();
78 web_contents_.reset(); 77 web_contents_.reset();
79 window_.reset(); 78 window_.reset();
80 } 79 }
81 80
82 } // namespace chromecast 81 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698