Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: services/kiosk_wm/kiosk_wm.cc

Issue 943053003: Simple multi-url support for mojo apps (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: hate Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "services/kiosk_wm/kiosk_wm.h" 5 #include "services/kiosk_wm/kiosk_wm.h"
6 6
7 #include "services/window_manager/basic_focus_rules.h" 7 #include "services/window_manager/basic_focus_rules.h"
8 8
9 namespace kiosk_wm { 9 namespace kiosk_wm {
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 void KioskWM::Initialize(mojo::ApplicationImpl* app) { 27 void KioskWM::Initialize(mojo::ApplicationImpl* app) {
28 window_manager_app_->Initialize(app); 28 window_manager_app_->Initialize(app);
29 29
30 // Format: --args-for="app_url default_url" 30 // Format: --args-for="app_url default_url"
31 if (app->args().size() > 1) 31 if (app->args().size() > 1)
32 default_url_ = app->args()[1]; 32 default_url_ = app->args()[1];
33 } 33 }
34 34
35 bool KioskWM::ConfigureIncomingConnection( 35 bool KioskWM::ConfigureIncomingConnection(
36 mojo::ApplicationConnection* connection) { 36 mojo::ApplicationConnection* connection,
37 window_manager_app_->ConfigureIncomingConnection(connection); 37 const std::string& url) {
38 window_manager_app_->ConfigureIncomingConnection(connection, url);
38 return true; 39 return true;
39 } 40 }
40 41
41 bool KioskWM::ConfigureOutgoingConnection( 42 bool KioskWM::ConfigureOutgoingConnection(
42 mojo::ApplicationConnection* connection) { 43 mojo::ApplicationConnection* connection) {
43 window_manager_app_->ConfigureOutgoingConnection(connection); 44 window_manager_app_->ConfigureOutgoingConnection(connection);
44 return true; 45 return true;
45 } 46 }
46 47
47 void KioskWM::OnEmbed( 48 void KioskWM::OnEmbed(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 view->RemoveObserver(this); 108 view->RemoveObserver(this);
108 } 109 }
109 110
110 void KioskWM::OnViewBoundsChanged(mojo::View* view, 111 void KioskWM::OnViewBoundsChanged(mojo::View* view,
111 const mojo::Rect& old_bounds, 112 const mojo::Rect& old_bounds,
112 const mojo::Rect& new_bounds) { 113 const mojo::Rect& new_bounds) {
113 content_->SetBounds(new_bounds); 114 content_->SetBounds(new_bounds);
114 } 115 }
115 116
116 // Convenience method: 117 // Convenience method:
117 void KioskWM::ReplaceContentWithURL(const mojo::String& url) { 118 void KioskWM::ReplaceContentWithURL(const std::string& url) {
118 Embed(url, nullptr, nullptr); 119 Embed(url, nullptr, nullptr);
119 } 120 }
120 121
121 bool KioskWM::AcceleratorPressed(const ui::Accelerator& accelerator, 122 bool KioskWM::AcceleratorPressed(const ui::Accelerator& accelerator,
122 ui::EventTarget* target) { 123 ui::EventTarget* target) {
123 if (accelerator.key_code() != ui::VKEY_BROWSER_BACK) 124 if (accelerator.key_code() != ui::VKEY_BROWSER_BACK)
124 return false; 125 return false;
125 navigator_host_.RequestNavigateHistory(-1); 126 navigator_host_.RequestNavigateHistory(-1);
126 return true; 127 return true;
127 } 128 }
128 129
129 bool KioskWM::CanHandleAccelerators() const { 130 bool KioskWM::CanHandleAccelerators() const {
130 return true; 131 return true;
131 } 132 }
132 133
133 } // namespace kiosk_wm 134 } // namespace kiosk_wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698