| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 GURL url(args[0]); | 29 GURL url(args[0]); |
| 30 if (url.is_valid() && url.has_scheme()) | 30 if (url.is_valid() && url.has_scheme()) |
| 31 return url; | 31 return url; |
| 32 | 32 |
| 33 return net::FilePathToFileURL( | 33 return net::FilePathToFileURL( |
| 34 base::MakeAbsoluteFilePath(base::FilePath(args[0]))); | 34 base::MakeAbsoluteFilePath(base::FilePath(args[0]))); |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 CastServiceSimple::CastServiceSimple( | 39 CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context, |
| 40 content::BrowserContext* browser_context, | 40 PrefService* pref_service, |
| 41 PrefService* pref_service) | 41 CastWindowManager* window_manager) |
| 42 : CastService(browser_context, pref_service) { | 42 : CastService(browser_context, pref_service), |
| 43 window_manager_(window_manager) { |
| 44 DCHECK(window_manager_); |
| 43 } | 45 } |
| 44 | 46 |
| 45 CastServiceSimple::~CastServiceSimple() { | 47 CastServiceSimple::~CastServiceSimple() { |
| 46 } | 48 } |
| 47 | 49 |
| 48 void CastServiceSimple::InitializeInternal() { | 50 void CastServiceSimple::InitializeInternal() { |
| 49 startup_url_ = GetStartupURL(); | 51 startup_url_ = GetStartupURL(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void CastServiceSimple::FinalizeInternal() { | 54 void CastServiceSimple::FinalizeInternal() { |
| 53 } | 55 } |
| 54 | 56 |
| 55 void CastServiceSimple::StartInternal() { | 57 void CastServiceSimple::StartInternal() { |
| 56 window_ = CastContentWindow::Create(this); | 58 window_ = CastContentWindow::Create(this); |
| 57 web_contents_ = window_->CreateWebContents(browser_context()); | 59 web_contents_ = window_->CreateWebContents(browser_context()); |
| 58 window_->ShowWebContents(web_contents_.get()); | 60 window_->ShowWebContents(web_contents_.get(), window_manager_); |
| 59 | 61 |
| 60 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | 62 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), |
| 61 ui::PAGE_TRANSITION_TYPED, | 63 ui::PAGE_TRANSITION_TYPED, |
| 62 std::string()); | 64 std::string()); |
| 63 web_contents_->Focus(); | 65 web_contents_->Focus(); |
| 64 } | 66 } |
| 65 | 67 |
| 66 void CastServiceSimple::StopInternal() { | 68 void CastServiceSimple::StopInternal() { |
| 67 web_contents_->ClosePage(); | 69 web_contents_->ClosePage(); |
| 68 web_contents_.reset(); | 70 web_contents_.reset(); |
| 69 window_.reset(); | 71 window_.reset(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void CastServiceSimple::OnWindowDestroyed() {} | 74 void CastServiceSimple::OnWindowDestroyed() {} |
| 73 | 75 |
| 74 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} | 76 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
| 75 | 77 |
| 76 } // namespace shell | 78 } // namespace shell |
| 77 } // namespace chromecast | 79 } // namespace chromecast |
| OLD | NEW |