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 "net/base/filename_util.h" | 13 #include "net/base/filename_util.h" |
15 #include "net/url_request/url_request_context_getter.h" | |
16 | 14 |
17 namespace chromecast { | 15 namespace chromecast { |
18 namespace shell { | 16 namespace shell { |
19 | 17 |
20 namespace { | 18 namespace { |
21 | 19 |
22 GURL GetStartupURL() { | 20 GURL GetStartupURL() { |
23 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 21 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
24 const base::CommandLine::StringVector& args = command_line->GetArgs(); | 22 const base::CommandLine::StringVector& args = command_line->GetArgs(); |
25 | 23 |
(...skipping 20 matching lines...) Expand all Loading... |
46 } | 44 } |
47 | 45 |
48 void CastServiceSimple::InitializeInternal() { | 46 void CastServiceSimple::InitializeInternal() { |
49 startup_url_ = GetStartupURL(); | 47 startup_url_ = GetStartupURL(); |
50 } | 48 } |
51 | 49 |
52 void CastServiceSimple::FinalizeInternal() { | 50 void CastServiceSimple::FinalizeInternal() { |
53 } | 51 } |
54 | 52 |
55 void CastServiceSimple::StartInternal() { | 53 void CastServiceSimple::StartInternal() { |
56 window_ = CastContentWindow::Create(this); | 54 cast_web_view_ = base::MakeUnique<CastWebView>( |
57 web_contents_ = window_->CreateWebContents(browser_context()); | 55 this, browser_context(), startup_url_, false); |
58 window_->ShowWebContents(web_contents_.get()); | 56 cast_web_view_->Show(); |
59 | |
60 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | |
61 ui::PAGE_TRANSITION_TYPED, | |
62 std::string()); | |
63 } | 57 } |
64 | 58 |
65 void CastServiceSimple::StopInternal() { | 59 void CastServiceSimple::StopInternal() { |
66 web_contents_->ClosePage(); | 60 cast_web_view_->ClosePage(); |
67 web_contents_.reset(); | 61 cast_web_view_.reset(); |
68 window_.reset(); | |
69 } | 62 } |
70 | 63 |
| 64 void CastServiceSimple::OnPageStopped(int error_code) {} |
| 65 |
| 66 void CastServiceSimple::OnLoadingStateChanged(bool loading) {} |
| 67 |
71 void CastServiceSimple::OnWindowDestroyed() {} | 68 void CastServiceSimple::OnWindowDestroyed() {} |
72 | 69 |
73 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} | 70 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
74 | 71 |
75 } // namespace shell | 72 } // namespace shell |
76 } // namespace chromecast | 73 } // namespace chromecast |
OLD | NEW |