| 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> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 9 #include "chromecast/browser/cast_content_window.h" | 11 #include "base/memory/ptr_util.h" |
| 10 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 11 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 12 #include "net/base/filename_util.h" | 14 #include "net/base/filename_util.h" |
| 13 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
| 14 | 16 |
| 15 namespace chromecast { | 17 namespace chromecast { |
| 16 namespace shell { | 18 namespace shell { |
| 17 | 19 |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 } | 46 } |
| 45 | 47 |
| 46 void CastServiceSimple::InitializeInternal() { | 48 void CastServiceSimple::InitializeInternal() { |
| 47 startup_url_ = GetStartupURL(); | 49 startup_url_ = GetStartupURL(); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void CastServiceSimple::FinalizeInternal() { | 52 void CastServiceSimple::FinalizeInternal() { |
| 51 } | 53 } |
| 52 | 54 |
| 53 void CastServiceSimple::StartInternal() { | 55 void CastServiceSimple::StartInternal() { |
| 54 window_.reset(new CastContentWindow); | 56 window_ = CastContentWindow::Create(this); |
| 55 web_contents_ = window_->CreateWebContents(browser_context()); | 57 web_contents_ = window_->CreateWebContents(browser_context()); |
| 56 window_->CreateWindowTree(web_contents_.get()); | 58 window_->ShowWebContents(web_contents_.get()); |
| 57 | 59 |
| 58 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | 60 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), |
| 59 ui::PAGE_TRANSITION_TYPED, | 61 ui::PAGE_TRANSITION_TYPED, |
| 60 std::string()); | 62 std::string()); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void CastServiceSimple::StopInternal() { | 65 void CastServiceSimple::StopInternal() { |
| 64 web_contents_->ClosePage(); | 66 web_contents_->ClosePage(); |
| 65 web_contents_.reset(); | 67 web_contents_.reset(); |
| 66 window_.reset(); | 68 window_.reset(); |
| 67 } | 69 } |
| 68 | 70 |
| 71 void CastServiceSimple::OnWindowDestroyed() {} |
| 72 |
| 73 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
| 74 |
| 69 } // namespace shell | 75 } // namespace shell |
| 70 } // namespace chromecast | 76 } // namespace chromecast |
| OLD | NEW |