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

Side by Side Diff: mojo/examples/window_manager/window_manager.cc

Issue 668483002: Change mojo URLs from mojo://mojo_foo to mojo://foo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/converters/geometry/geometry_type_converters.h" 8 #include "mojo/converters/geometry/geometry_type_converters.h"
9 #include "mojo/converters/input_events/input_events_type_converters.h" 9 #include "mojo/converters/input_events/input_events_type_converters.h"
10 #include "mojo/examples/keyboard/keyboard.mojom.h" 10 #include "mojo/examples/keyboard/keyboard.mojom.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 View* view() { return view_; } 153 View* view() { return view_; }
154 154
155 void Init(ApplicationImpl* application, 155 void Init(ApplicationImpl* application,
156 ViewManager* view_manager, 156 ViewManager* view_manager,
157 View* parent, 157 View* parent,
158 const gfx::Rect& bounds) { 158 const gfx::Rect& bounds) {
159 view_manager_ = view_manager; 159 view_manager_ = view_manager;
160 view_ = View::Create(view_manager); 160 view_ = View::Create(view_manager);
161 view_->SetBounds(bounds); 161 view_->SetBounds(bounds);
162 parent->AddChild(view_); 162 parent->AddChild(view_);
163 view_->Embed("mojo:mojo_keyboard"); 163 view_->Embed("mojo:keyboard");
164 application->ConnectToService("mojo:mojo_keyboard", &keyboard_service_); 164 application->ConnectToService("mojo:keyboard", &keyboard_service_);
165 keyboard_service_.set_client(this); 165 keyboard_service_.set_client(this);
166 parent->AddObserver(this); 166 parent->AddObserver(this);
167 } 167 }
168 168
169 void Show(Id view_id, const gfx::Rect& bounds) { 169 void Show(Id view_id, const gfx::Rect& bounds) {
170 keyboard_service_->SetTarget(view_id); 170 keyboard_service_->SetTarget(view_id);
171 view_->SetVisible(true); 171 view_->SetVisible(true);
172 } 172 }
173 173
174 void Hide(Id view_id) { 174 void Hide(Id view_id) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 dest_view->Embed(url); 483 dest_view->Embed(url);
484 } 484 }
485 485
486 // TODO(beng): proper layout manager!! 486 // TODO(beng): proper layout manager!!
487 Id CreateLauncherUI() { 487 Id CreateLauncherUI() {
488 View* view = view_manager_->GetViewById(content_view_id_); 488 View* view = view_manager_->GetViewById(content_view_id_);
489 gfx::Rect bounds = view->bounds(); 489 gfx::Rect bounds = view->bounds();
490 bounds.Inset(kBorderInset, kBorderInset); 490 bounds.Inset(kBorderInset, kBorderInset);
491 bounds.set_height(kTextfieldHeight); 491 bounds.set_height(kTextfieldHeight);
492 launcher_ui_ = CreateWindow(bounds); 492 launcher_ui_ = CreateWindow(bounds);
493 launcher_ui_->Embed("mojo:mojo_browser"); 493 launcher_ui_->Embed("mojo:browser");
494 return launcher_ui_->view()->id(); 494 return launcher_ui_->view()->id();
495 } 495 }
496 496
497 Window* CreateWindow() { 497 Window* CreateWindow() {
498 View* view = view_manager_->GetViewById(content_view_id_); 498 View* view = view_manager_->GetViewById(content_view_id_);
499 gfx::Rect bounds(kBorderInset, 499 gfx::Rect bounds(kBorderInset,
500 2 * kBorderInset + kTextfieldHeight, 500 2 * kBorderInset + kTextfieldHeight,
501 view->bounds().width() - 3 * kBorderInset - 501 view->bounds().width() - 3 * kBorderInset -
502 kControlPanelWidth, 502 kControlPanelWidth,
503 view->bounds().height() - 503 view->bounds().height() -
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 window_manager_->RequestNavigate(view_id_, target, request.Pass()); 594 window_manager_->RequestNavigate(view_id_, target, request.Pass());
595 } 595 }
596 596
597 } // namespace examples 597 } // namespace examples
598 } // namespace mojo 598 } // namespace mojo
599 599
600 MojoResult MojoMain(MojoHandle shell_handle) { 600 MojoResult MojoMain(MojoHandle shell_handle) {
601 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager); 601 mojo::ApplicationRunnerChromium runner(new mojo::examples::WindowManager);
602 return runner.Run(shell_handle); 602 return runner.Run(shell_handle);
603 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698