| 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 "mojo/services/kiosk_wm/kiosk_wm.h" | 5 #include "mojo/services/kiosk_wm/kiosk_wm.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 8 #include "base/strings/utf_string_conversions.h" | |
| 9 #include "mojo/services/kiosk_wm/merged_service_provider.h" | 7 #include "mojo/services/kiosk_wm/merged_service_provider.h" |
| 10 #include "mojo/services/window_manager/basic_focus_rules.h" | 8 #include "mojo/services/window_manager/basic_focus_rules.h" |
| 11 | 9 |
| 12 namespace kiosk_wm { | 10 namespace kiosk_wm { |
| 13 | 11 |
| 14 KioskWM::KioskWM() | 12 KioskWM::KioskWM() |
| 15 : window_manager_app_(new window_manager::WindowManagerApp(this, this)), | 13 : window_manager_app_(new window_manager::WindowManagerApp(this, this)), |
| 16 root_(nullptr), | 14 root_(nullptr), |
| 17 content_(nullptr), | 15 content_(nullptr), |
| 18 navigator_host_(this), | 16 navigator_host_(this), |
| 19 weak_factory_(this) { | 17 weak_factory_(this) { |
| 20 exposed_services_impl_.AddService(this); | 18 exposed_services_impl_.AddService(this); |
| 21 } | 19 } |
| 22 | 20 |
| 23 KioskWM::~KioskWM() { | 21 KioskWM::~KioskWM() { |
| 24 } | 22 } |
| 25 | 23 |
| 26 base::WeakPtr<KioskWM> KioskWM::GetWeakPtr() { | 24 base::WeakPtr<KioskWM> KioskWM::GetWeakPtr() { |
| 27 return weak_factory_.GetWeakPtr(); | 25 return weak_factory_.GetWeakPtr(); |
| 28 } | 26 } |
| 29 | 27 |
| 30 void KioskWM::Initialize(mojo::ApplicationImpl* app) { | 28 void KioskWM::Initialize(mojo::ApplicationImpl* app) { |
| 31 window_manager_app_->Initialize(app); | 29 window_manager_app_->Initialize(app); |
| 32 | 30 |
| 33 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 31 // Format: --args-for="app_url default_url" |
| 34 base::CommandLine::StringVector args = command_line->GetArgs(); | 32 if (app->args().size() > 1) |
| 35 if (args.empty()) { | 33 default_url_ = app->args()[1]; |
| 36 default_url_ = "http://www.google.com/"; | |
| 37 } else { | |
| 38 #if defined(OS_WIN) | |
| 39 default_url_ = base::WideToUTF8(args[0]); | |
| 40 #else | |
| 41 default_url_ = args[0]; | |
| 42 #endif | |
| 43 } | |
| 44 } | 34 } |
| 45 | 35 |
| 46 bool KioskWM::ConfigureIncomingConnection( | 36 bool KioskWM::ConfigureIncomingConnection( |
| 47 mojo::ApplicationConnection* connection) { | 37 mojo::ApplicationConnection* connection) { |
| 48 window_manager_app_->ConfigureIncomingConnection(connection); | 38 window_manager_app_->ConfigureIncomingConnection(connection); |
| 49 return true; | 39 return true; |
| 50 } | 40 } |
| 51 | 41 |
| 52 bool KioskWM::ConfigureOutgoingConnection( | 42 bool KioskWM::ConfigureOutgoingConnection( |
| 53 mojo::ApplicationConnection* connection) { | 43 mojo::ApplicationConnection* connection) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return false; | 129 return false; |
| 140 navigator_host_.RequestNavigateHistory(-1); | 130 navigator_host_.RequestNavigateHistory(-1); |
| 141 return true; | 131 return true; |
| 142 } | 132 } |
| 143 | 133 |
| 144 bool KioskWM::CanHandleAccelerators() const { | 134 bool KioskWM::CanHandleAccelerators() const { |
| 145 return true; | 135 return true; |
| 146 } | 136 } |
| 147 | 137 |
| 148 } // namespace kiosk_wm | 138 } // namespace kiosk_wm |
| OLD | NEW |