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