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

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

Issue 433513005: Pass ServiceProvider thru ViewManagerService::Embed() allowing embedder & embeddee to expose servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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 ServiceProviderImpl* 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
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
OLDNEW
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698