| 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_contents_ = |
| 57 web_contents_ = window_->CreateWebContents(browser_context()); | 55 base::MakeUnique<CastWebContents>(this, browser_context()); |
| 58 window_->ShowWebContents(web_contents_.get()); | 56 cast_web_contents_->MakeVisible(); |
| 59 | 57 cast_web_contents_->LoadUrl(startup_url_); |
| 60 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | |
| 61 ui::PAGE_TRANSITION_TYPED, | |
| 62 std::string()); | |
| 63 } | 58 } |
| 64 | 59 |
| 65 void CastServiceSimple::StopInternal() { | 60 void CastServiceSimple::StopInternal() { |
| 66 web_contents_->ClosePage(); | 61 cast_web_contents_->ClosePage(); |
| 67 web_contents_.reset(); | 62 cast_web_contents_.reset(); |
| 68 window_.reset(); | |
| 69 } | 63 } |
| 70 | 64 |
| 65 void CastServiceSimple::OnPageStopped(int error_code) {} |
| 66 |
| 67 void CastServiceSimple::OnLoadingStateChanged(bool loading) {} |
| 68 |
| 71 void CastServiceSimple::OnWindowDestroyed() {} | 69 void CastServiceSimple::OnWindowDestroyed() {} |
| 72 | 70 |
| 73 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} | 71 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
| 74 | 72 |
| 75 } // namespace shell | 73 } // namespace shell |
| 76 } // namespace chromecast | 74 } // namespace chromecast |
| OLD | NEW |