| 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 "base/basictypes.h" | 5 #include "base/basictypes.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/examples/keyboard/keyboard.mojom.h" | 8 #include "mojo/examples/keyboard/keyboard.mojom.h" |
| 9 #include "mojo/examples/keyboard/keyboard_delegate.h" | 9 #include "mojo/examples/keyboard/keyboard_delegate.h" |
| 10 #include "mojo/examples/keyboard/keyboard_view.h" | 10 #include "mojo/examples/keyboard/keyboard_view.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 views::Widget::InitParams params( | 84 views::Widget::InitParams params( |
| 85 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 85 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 86 params.native_widget = new NativeWidgetViewManager(widget, node); | 86 params.native_widget = new NativeWidgetViewManager(widget, node); |
| 87 params.delegate = widget_delegate; | 87 params.delegate = widget_delegate; |
| 88 params.bounds = gfx::Rect(node->bounds().width(), node->bounds().height()); | 88 params.bounds = gfx::Rect(node->bounds().width(), node->bounds().height()); |
| 89 widget->Init(params); | 89 widget->Init(params); |
| 90 widget->Show(); | 90 widget->Show(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // ViewManagerDelegate: | 93 // ViewManagerDelegate: |
| 94 virtual void OnEmbed(ViewManager* view_manager, Node* root) OVERRIDE { | 94 virtual void OnEmbed(ViewManager* view_manager, |
| 95 Node* root, |
| 96 ExportedServiceRegistry* exported_services, |
| 97 scoped_ptr<ServiceProvider> imported_services) OVERRIDE { |
| 95 // TODO: deal with OnEmbed() being invoked multiple times. | 98 // TODO: deal with OnEmbed() being invoked multiple times. |
| 96 view_manager_ = view_manager; | 99 view_manager_ = view_manager; |
| 97 root->SetActiveView(View::Create(view_manager)); | 100 root->SetActiveView(View::Create(view_manager)); |
| 98 CreateWidget(root); | 101 CreateWidget(root); |
| 99 } | 102 } |
| 100 virtual void OnViewManagerDisconnected( | 103 virtual void OnViewManagerDisconnected( |
| 101 ViewManager* view_manager) OVERRIDE { | 104 ViewManager* view_manager) OVERRIDE { |
| 102 DCHECK_EQ(view_manager_, view_manager); | 105 DCHECK_EQ(view_manager_, view_manager); |
| 103 view_manager_ = NULL; | 106 view_manager_ = NULL; |
| 104 base::MessageLoop::current()->Quit(); | 107 base::MessageLoop::current()->Quit(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 140 } |
| 138 | 141 |
| 139 } // namespace examples | 142 } // namespace examples |
| 140 | 143 |
| 141 // static | 144 // static |
| 142 ApplicationDelegate* ApplicationDelegate::Create() { | 145 ApplicationDelegate* ApplicationDelegate::Create() { |
| 143 return new examples::Keyboard; | 146 return new examples::Keyboard; |
| 144 } | 147 } |
| 145 | 148 |
| 146 } // namespace mojo | 149 } // namespace mojo |
| OLD | NEW |