| 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_ = base::MakeUnique<CastWebView>(this, browser_context(), |
| 64 web_contents_ = window_->CreateWebContents(browser_context()); | 62 /*site_instance*/ nullptr, |
| 65 window_->ShowWebContents(web_contents_.get(), window_manager_); | 63 /*transparent*/ false); |
| 66 | 64 cast_web_view_->Show(window_manager_); |
| 67 web_contents_->GetController().LoadURL(startup_url_, content::Referrer(), | 65 cast_web_view_->LoadUrl(startup_url_); |
| 68 ui::PAGE_TRANSITION_TYPED, | |
| 69 std::string()); | |
| 70 web_contents_->Focus(); | |
| 71 } | 66 } |
| 72 | 67 |
| 73 void CastServiceSimple::StopInternal() { | 68 void CastServiceSimple::StopInternal() { |
| 74 if (web_contents_) { | 69 if (cast_web_view_) { |
| 75 web_contents_->ClosePage(); | 70 cast_web_view_->ClosePage(); |
| 76 web_contents_.reset(); | |
| 77 } | 71 } |
| 78 if (window_) { | 72 cast_web_view_.reset(); |
| 79 window_.reset(); | |
| 80 } | |
| 81 } | 73 } |
| 82 | 74 |
| 75 void CastServiceSimple::OnPageStopped(int error_code) {} |
| 76 |
| 77 void CastServiceSimple::OnLoadingStateChanged(bool loading) {} |
| 78 |
| 83 void CastServiceSimple::OnWindowDestroyed() {} | 79 void CastServiceSimple::OnWindowDestroyed() {} |
| 84 | 80 |
| 85 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} | 81 void CastServiceSimple::OnKeyEvent(const ui::KeyEvent& key_event) {} |
| 86 | 82 |
| 87 } // namespace shell | 83 } // namespace shell |
| 88 } // namespace chromecast | 84 } // namespace chromecast |
| OLD | NEW |