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

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

Issue 658923003: Remove dependency on ui from view_manager. (Closed) Base URL: https://github.com/domokit/mojo.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/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/examples/keyboard/keyboard.mojom.h" 9 #include "mojo/examples/keyboard/keyboard.mojom.h"
10 #include "mojo/examples/keyboard/keyboard_delegate.h" 10 #include "mojo/examples/keyboard/keyboard_delegate.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void CreateWidget(View* view) { 85 void CreateWidget(View* view) {
86 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; 86 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView;
87 widget_delegate->GetContentsView()->AddChildView(new KeyboardView(this)); 87 widget_delegate->GetContentsView()->AddChildView(new KeyboardView(this));
88 widget_delegate->GetContentsView()->SetLayoutManager(new views::FillLayout); 88 widget_delegate->GetContentsView()->SetLayoutManager(new views::FillLayout);
89 89
90 views::Widget* widget = new views::Widget; 90 views::Widget* widget = new views::Widget;
91 views::Widget::InitParams params( 91 views::Widget::InitParams params(
92 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 92 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
93 params.native_widget = new NativeWidgetViewManager(widget, shell_, view); 93 params.native_widget = new NativeWidgetViewManager(widget, shell_, view);
94 params.delegate = widget_delegate; 94 params.delegate = widget_delegate;
95 params.bounds = gfx::Rect(view->bounds().width(), view->bounds().height()); 95 params.bounds = gfx::Rect(view->bounds().width, view->bounds().height);
96 widget->Init(params); 96 widget->Init(params);
97 widget->Show(); 97 widget->Show();
98 } 98 }
99 99
100 // ViewManagerDelegate: 100 // ViewManagerDelegate:
101 virtual void OnEmbed(ViewManager* view_manager, 101 virtual void OnEmbed(ViewManager* view_manager,
102 View* root, 102 View* root,
103 ServiceProviderImpl* exported_services, 103 ServiceProviderImpl* exported_services,
104 scoped_ptr<ServiceProvider> imported_services) override { 104 scoped_ptr<ServiceProvider> imported_services) override {
105 // TODO: deal with OnEmbed() being invoked multiple times. 105 // TODO: deal with OnEmbed() being invoked multiple times.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 keyboard_->set_target(view_id); 147 keyboard_->set_target(view_id);
148 } 148 }
149 149
150 } // namespace examples 150 } // namespace examples
151 } // namespace mojo 151 } // namespace mojo
152 152
153 MojoResult MojoMain(MojoHandle shell_handle) { 153 MojoResult MojoMain(MojoHandle shell_handle) {
154 mojo::ApplicationRunnerChromium runner(new mojo::examples::Keyboard); 154 mojo::ApplicationRunnerChromium runner(new mojo::examples::Keyboard);
155 return runner.Run(shell_handle); 155 return runner.Run(shell_handle);
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698