OLD | NEW |
---|---|
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "content/public/browser/render_view_host.h" | |
13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
14 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
15 #include "net/base/filename_util.h" | 14 #include "net/base/filename_util.h" |
16 #include "net/url_request/url_request_context_getter.h" | |
17 | 15 |
18 namespace chromecast { | 16 namespace chromecast { |
19 namespace shell { | 17 namespace shell { |
20 | 18 |
21 namespace { | 19 namespace { |
22 | 20 |
23 GURL GetStartupURL() { | 21 GURL GetStartupURL() { |
24 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 22 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
25 const base::CommandLine::StringVector& args = command_line->GetArgs(); | 23 const base::CommandLine::StringVector& args = command_line->GetArgs(); |
26 | 24 |
(...skipping 26 matching lines...) Expand all Loading... | |
53 } | 51 } |
54 | 52 |
55 void CastServiceSimple::FinalizeInternal() { | 53 void CastServiceSimple::FinalizeInternal() { |
56 } | 54 } |
57 | 55 |
58 void CastServiceSimple::StartInternal() { | 56 void CastServiceSimple::StartInternal() { |
59 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { | 57 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) { |
60 return; | 58 return; |
61 } | 59 } |
62 | 60 |
63 window_ = CastContentWindow::Create(this); | 61 cast_web_view_ = |
64 web_contents_ = window_->CreateWebContents(browser_context()); | 62 base::MakeUnique<CastWebView>(this, browser_context(), nullptr, false); |
halliwell
2017/02/20 22:09:11
nit: comment what nullptr, false mean?
derekjchow1
2017/02/22 00:50:41
Done.
| |
65 window_->ShowWebContents(web_contents_.get(), window_manager_); | 63 cast_web_view_->Show(window_manager_); |
66 | 64 cast_web_view_->LoadUrl(startup_url_); |
67 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | |
68 ui::PAGE_TRANSITION_TYPED, | |
69 std::string()); | |
70 web_contents_->Focus(); | |
71 } | 65 } |
72 | 66 |
73 void CastServiceSimple::StopInternal() { | 67 void CastServiceSimple::StopInternal() { |
74 if (web_contents_) { | 68 if (cast_web_view_) { |
75 web_contents_->ClosePage(); | 69 cast_web_view_->ClosePage(); |
76 web_contents_.reset(); | |
77 } | 70 } |
78 if (window_) { | 71 cast_web_view_.reset(); |
79 window_.reset(); | |
80 } | |
81 } | 72 } |
82 | 73 |
74 void CastServiceSimple::OnPageStopped(int error_code) {} | |
75 | |
76 void CastServiceSimple::OnLoadingStateChanged(bool loading) {} | |
77 | |
83 void CastServiceSimple::OnWindowDestroyed() {} | 78 void CastServiceSimple::OnWindowDestroyed() {} |
84 | 79 |
85 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} | 80 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
86 | 81 |
87 } // namespace shell | 82 } // namespace shell |
88 } // namespace chromecast | 83 } // namespace chromecast |
OLD | NEW |