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

Side by Side Diff: mojo/services/window_manager/main.cc

Issue 474883003: Move focus from the view manager to the window manager. (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/services/window_manager/DEPS ('k') | mojo/services/window_manager/window_manager_app.h » ('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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "mojo/public/cpp/application/application_delegate.h" 6 #include "mojo/public/cpp/application/application_delegate.h"
7 #include "mojo/public/cpp/application/service_provider_impl.h" 7 #include "mojo/public/cpp/application/service_provider_impl.h"
8 #include "mojo/services/public/cpp/view_manager/view_manager.h" 8 #include "mojo/services/public/cpp/view_manager/view_manager.h"
9 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 9 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
10 #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h" 10 #include "mojo/services/public/cpp/view_manager/window_manager_delegate.h"
11 #include "mojo/services/window_manager/window_manager_app.h" 11 #include "mojo/services/window_manager/window_manager_app.h"
12 12
13 // ApplicationDelegate implementation file for WindowManager users (e.g. 13 // ApplicationDelegate implementation file for WindowManager users (e.g.
14 // core window manager tests) that do not want to provide their own 14 // core window manager tests) that do not want to provide their own
15 // ApplicationDelegate::Create(). 15 // ApplicationDelegate::Create().
16 16
17 namespace mojo { 17 namespace mojo {
18 18
19 class DefaultWindowManager : public ApplicationDelegate, 19 class DefaultWindowManager : public ApplicationDelegate,
20 public ViewManagerDelegate, 20 public ViewManagerDelegate,
21 public WindowManagerDelegate { 21 public WindowManagerDelegate {
22 public: 22 public:
23 DefaultWindowManager() 23 DefaultWindowManager()
24 : window_manager_app_(new WindowManagerApp(this)), 24 : window_manager_app_(new WindowManagerApp(this, this)),
25 view_manager_(NULL), 25 view_manager_(NULL),
26 root_(NULL) {} 26 root_(NULL) {}
27 virtual ~DefaultWindowManager() {} 27 virtual ~DefaultWindowManager() {}
28 28
29 private: 29 private:
30 // Overridden from ApplicationDelegate: 30 // Overridden from ApplicationDelegate:
31 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE { 31 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE {
32 window_manager_app_->Initialize(impl); 32 window_manager_app_->Initialize(impl);
33 } 33 }
34 virtual bool ConfigureIncomingConnection( 34 virtual bool ConfigureIncomingConnection(
(...skipping 17 matching lines...) Expand all
52 52
53 // Overridden from WindowManagerDelegate: 53 // Overridden from WindowManagerDelegate:
54 virtual void Embed( 54 virtual void Embed(
55 const String& url, 55 const String& url,
56 InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE { 56 InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE {
57 View* view = View::Create(view_manager_); 57 View* view = View::Create(view_manager_);
58 root_->AddChild(view); 58 root_->AddChild(view);
59 view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>( 59 view->Embed(url, scoped_ptr<mojo::ServiceProviderImpl>(
60 new mojo::ServiceProviderImpl).Pass()); 60 new mojo::ServiceProviderImpl).Pass());
61 } 61 }
62 virtual void DispatchEvent(View* target, EventPtr event) MOJO_OVERRIDE {} 62 virtual void DispatchEvent(EventPtr event) MOJO_OVERRIDE {}
63 63
64 scoped_ptr<WindowManagerApp> window_manager_app_; 64 scoped_ptr<WindowManagerApp> window_manager_app_;
65 65
66 ViewManager* view_manager_; 66 ViewManager* view_manager_;
67 View* root_; 67 View* root_;
68 68
69 MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager); 69 MOJO_DISALLOW_COPY_AND_ASSIGN(DefaultWindowManager);
70 }; 70 };
71 71
72 // static 72 // static
73 ApplicationDelegate* ApplicationDelegate::Create() { 73 ApplicationDelegate* ApplicationDelegate::Create() {
74 return new DefaultWindowManager; 74 return new DefaultWindowManager;
75 } 75 }
76 76
77 } // namespace mojo 77 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/window_manager/DEPS ('k') | mojo/services/window_manager/window_manager_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698