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

Side by Side Diff: mojo/examples/window_manager/window_manager.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/png_viewer/png_viewer.cc ('k') | mojo/examples/wm_flow/app/app.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/bind.h" 6 #include "base/bind.h"
7 #include "mojo/examples/keyboard/keyboard.mojom.h" 7 #include "mojo/examples/keyboard/keyboard.mojom.h"
8 #include "mojo/examples/window_manager/debug_panel.h" 8 #include "mojo/examples/window_manager/debug_panel.h"
9 #include "mojo/examples/window_manager/window_manager.mojom.h" 9 #include "mojo/examples/window_manager/window_manager.mojom.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) 331 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
332 MOJO_OVERRIDE { 332 MOJO_OVERRIDE {
333 connection->AddService(&window_manager_factory_); 333 connection->AddService(&window_manager_factory_);
334 connection->AddService(&navigator_host_factory_); 334 connection->AddService(&navigator_host_factory_);
335 connection->AddService(&view_manager_client_factory_); 335 connection->AddService(&view_manager_client_factory_);
336 return true; 336 return true;
337 } 337 }
338 338
339 // Overridden from ViewManagerDelegate: 339 // Overridden from ViewManagerDelegate:
340 virtual void OnEmbed(ViewManager* view_manager, Node* root) OVERRIDE { 340 virtual void OnEmbed(ViewManager* view_manager,
341 Node* root,
342 ServiceProviderImpl* exported_services,
343 scoped_ptr<ServiceProvider> imported_services) OVERRIDE {
341 DCHECK(!view_manager_); 344 DCHECK(!view_manager_);
342 view_manager_ = view_manager; 345 view_manager_ = view_manager;
343 view_manager_->SetWindowManagerDelegate(this); 346 view_manager_->SetWindowManagerDelegate(this);
344 347
345 Node* node = Node::Create(view_manager_); 348 Node* node = Node::Create(view_manager_);
346 root->AddChild(node); 349 root->AddChild(node);
347 node->SetBounds(gfx::Rect(root->bounds().size())); 350 node->SetBounds(gfx::Rect(root->bounds().size()));
348 content_node_id_ = node->id(); 351 content_node_id_ = node->id();
349 352
350 View* view = View::Create(view_manager_); 353 View* view = View::Create(view_manager_);
(...skipping 10 matching lines...) Expand all
361 control_panel_id)); 364 control_panel_id));
362 root->AddObserver(root_layout_manager_.get()); 365 root->AddObserver(root_layout_manager_.get());
363 } 366 }
364 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE { 367 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE {
365 DCHECK_EQ(view_manager_, view_manager); 368 DCHECK_EQ(view_manager_, view_manager);
366 view_manager_ = NULL; 369 view_manager_ = NULL;
367 base::MessageLoop::current()->Quit(); 370 base::MessageLoop::current()->Quit();
368 } 371 }
369 372
370 // Overridden from WindowManagerDelegate: 373 // Overridden from WindowManagerDelegate:
371 virtual void Embed(const String& url) OVERRIDE { 374 virtual void Embed(
375 const String& url,
376 InterfaceRequest<ServiceProvider> service_provider) OVERRIDE {
372 CreateWindow(url, 377 CreateWindow(url,
373 NavigationDetailsPtr().Pass(), 378 NavigationDetailsPtr().Pass(),
374 ResponseDetailsPtr().Pass()); 379 ResponseDetailsPtr().Pass());
375 } 380 }
376 virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE { 381 virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE {
377 // TODO(beng): More sophisticated focus handling than this is required! 382 // TODO(beng): More sophisticated focus handling than this is required!
378 if (event->action == EVENT_TYPE_MOUSE_PRESSED && 383 if (event->action == EVENT_TYPE_MOUSE_PRESSED &&
379 !IsDescendantOfKeyboard(target)) { 384 !IsDescendantOfKeyboard(target)) {
380 target->node()->SetFocus(); 385 target->node()->SetFocus();
381 } 386 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 555 }
551 556
552 } // namespace examples 557 } // namespace examples
553 558
554 // static 559 // static
555 ApplicationDelegate* ApplicationDelegate::Create() { 560 ApplicationDelegate* ApplicationDelegate::Create() {
556 return new examples::WindowManager; 561 return new examples::WindowManager;
557 } 562 }
558 563
559 } // namespace mojo 564 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/png_viewer/png_viewer.cc ('k') | mojo/examples/wm_flow/app/app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698