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

Side by Side Diff: sky/tools/debugger/debugger.cc

Issue 858103002: Remove [Client=] annotation from ServiceProvider (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase for trybots (no code changes from ps2) Created 5 years, 11 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
« no previous file with comments | « sky/tools/debugger/debugger.h ('k') | sky/tools/tester/test_runner.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 "sky/tools/debugger/debugger.h" 5 #include "sky/tools/debugger/debugger.h"
6 6
7 #include "services/window_manager/basic_focus_rules.h" 7 #include "services/window_manager/basic_focus_rules.h"
8 8
9 namespace sky { 9 namespace sky {
10 namespace debugger { 10 namespace debugger {
11 11
12 SkyDebugger::SkyDebugger() 12 SkyDebugger::SkyDebugger()
13 : window_manager_app_(new window_manager::WindowManagerApp(this, this)), 13 : window_manager_app_(new window_manager::WindowManagerApp(this, this)),
14 root_(nullptr), 14 root_(nullptr),
15 content_(nullptr), 15 content_(nullptr),
16 navigator_host_factory_(this), 16 navigator_host_factory_(this),
17 weak_factory_(this) { 17 weak_factory_(this) {
18 exposed_services_impl_.AddService(&navigator_host_factory_);
18 } 19 }
19 20
20 SkyDebugger::~SkyDebugger() { 21 SkyDebugger::~SkyDebugger() {
21 } 22 }
22 23
23 base::WeakPtr<SkyDebugger> SkyDebugger::GetWeakPtr() { 24 base::WeakPtr<SkyDebugger> SkyDebugger::GetWeakPtr() {
24 return weak_factory_.GetWeakPtr(); 25 return weak_factory_.GetWeakPtr();
25 } 26 }
26 27
27 void SkyDebugger::Initialize(mojo::ApplicationImpl* app) { 28 void SkyDebugger::Initialize(mojo::ApplicationImpl* app) {
(...skipping 10 matching lines...) Expand all
38 39
39 bool SkyDebugger::ConfigureOutgoingConnection( 40 bool SkyDebugger::ConfigureOutgoingConnection(
40 mojo::ApplicationConnection* connection) { 41 mojo::ApplicationConnection* connection) {
41 window_manager_app_->ConfigureOutgoingConnection(connection); 42 window_manager_app_->ConfigureOutgoingConnection(connection);
42 connection->AddService(this); 43 connection->AddService(this);
43 return true; 44 return true;
44 } 45 }
45 46
46 void SkyDebugger::OnEmbed( 47 void SkyDebugger::OnEmbed(
47 mojo::View* root, 48 mojo::View* root,
48 mojo::ServiceProviderImpl* exported_services, 49 mojo::InterfaceRequest<mojo::ServiceProvider> services,
49 scoped_ptr<mojo::ServiceProvider> imported_services) { 50 mojo::ServiceProviderPtr exposed_services) {
50 root_ = root; 51 root_ = root;
51 root_->AddObserver(this); 52 root_->AddObserver(this);
52 53
53 window_manager_app_->SetViewportSize(gfx::Size(320, 640)); 54 window_manager_app_->SetViewportSize(gfx::Size(320, 640));
54 55
55 content_ = root->view_manager()->CreateView(); 56 content_ = root->view_manager()->CreateView();
56 content_->SetBounds(root_->bounds()); 57 content_->SetBounds(root_->bounds());
57 root_->AddChild(content_); 58 root_->AddChild(content_);
58 content_->SetVisible(true); 59 content_->SetVisible(true);
59 60
60 window_manager_app_->InitFocus( 61 window_manager_app_->InitFocus(
61 make_scoped_ptr(new window_manager::BasicFocusRules(root_))); 62 make_scoped_ptr(new window_manager::BasicFocusRules(root_)));
62 63
63 if (!pending_url_.empty()) 64 if (!pending_url_.empty())
64 NavigateToURL(pending_url_); 65 NavigateToURL(pending_url_);
65 } 66 }
66 67
67 void SkyDebugger::Embed( 68 void SkyDebugger::Embed(const mojo::String& url,
68 const mojo::String& url, 69 mojo::InterfaceRequest<mojo::ServiceProvider> services,
69 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) { 70 mojo::ServiceProviderPtr exposed_services) {
70 scoped_ptr<mojo::ServiceProviderImpl> exported_services( 71 content_->Embed(url, nullptr, nullptr);
71 new mojo::ServiceProviderImpl());
72 // exported_services->AddService(TBD) -- no exported services for now.
73 content_->Embed(url, exported_services.Pass());
74 } 72 }
75 73
76 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { 74 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) {
77 root_ = nullptr; 75 root_ = nullptr;
78 } 76 }
79 77
80 void SkyDebugger::OnViewDestroyed(mojo::View* view) { 78 void SkyDebugger::OnViewDestroyed(mojo::View* view) {
81 view->RemoveObserver(this); 79 view->RemoveObserver(this);
82 } 80 }
83 81
84 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, 82 void SkyDebugger::OnViewBoundsChanged(mojo::View* view,
85 const mojo::Rect& old_bounds, 83 const mojo::Rect& old_bounds,
86 const mojo::Rect& new_bounds) { 84 const mojo::Rect& new_bounds) {
87 content_->SetBounds(new_bounds); 85 content_->SetBounds(new_bounds);
88 } 86 }
89 87
90 void SkyDebugger::Create(mojo::ApplicationConnection* connection, 88 void SkyDebugger::Create(mojo::ApplicationConnection* connection,
91 mojo::InterfaceRequest<Debugger> request) { 89 mojo::InterfaceRequest<Debugger> request) {
92 mojo::WeakBindToRequest(this, &request); 90 mojo::WeakBindToRequest(this, &request);
93 } 91 }
94 92
95 void SkyDebugger::NavigateToURL(const mojo::String& url) { 93 void SkyDebugger::NavigateToURL(const mojo::String& url) {
96 // We can get Navigate commands before we've actually been 94 // We can get Navigate commands before we've actually been
97 // embedded into the view and content_ created. 95 // embedded into the view and content_ created.
98 // Just save the last one. 96 // Just save the last one.
99 if (content_) { 97 if (content_) {
100 scoped_ptr<mojo::ServiceProviderImpl> exported_services( 98 mojo::ServiceProviderPtr exposed_services;
101 new mojo::ServiceProviderImpl()); 99 exposed_services_impl_.Bind(GetProxy(&exposed_services));
102 exported_services->AddService(&navigator_host_factory_); 100 content_->Embed(url, GetProxy(&viewer_services_), exposed_services.Pass());
103 viewer_services_ = content_->Embed(url, exported_services.Pass());
104 } else { 101 } else {
105 pending_url_ = url; 102 pending_url_ = url;
106 } 103 }
107 } 104 }
108 105
109 void SkyDebugger::Shutdown() { 106 void SkyDebugger::Shutdown() {
110 // Make sure we shut down mojo before quitting the message loop or things 107 // Make sure we shut down mojo before quitting the message loop or things
111 // like blink::shutdown() may try to talk to the message loop and crash. 108 // like blink::shutdown() may try to talk to the message loop and crash.
112 window_manager_app_.reset(); 109 window_manager_app_.reset();
113 110
114 // TODO(eseidel): This still hits an X11 error which I don't understand 111 // TODO(eseidel): This still hits an X11 error which I don't understand
115 // "X Error of failed request: GLXBadDrawable", crbug.com/430581 112 // "X Error of failed request: GLXBadDrawable", crbug.com/430581
116 mojo::ApplicationImpl::Terminate(); 113 mojo::ApplicationImpl::Terminate();
117 // TODO(eseidel): REMOVE THIS, temporarily fast-exit now to stop confusing 114 // TODO(eseidel): REMOVE THIS, temporarily fast-exit now to stop confusing
118 // folks with exit-time crashes due to GLXBadDrawable above. 115 // folks with exit-time crashes due to GLXBadDrawable above.
119 exit(0); 116 exit(0);
120 } 117 }
121 118
122 void SkyDebugger::InjectInspector() { 119 void SkyDebugger::InjectInspector() {
123 InspectorServicePtr inspector_service; 120 InspectorServicePtr inspector_service;
124 mojo::ConnectToService(viewer_services_.get(), &inspector_service); 121 mojo::ConnectToService(viewer_services_.get(), &inspector_service);
125 inspector_service->Inject(); 122 inspector_service->Inject();
126 } 123 }
127 124
128 } // namespace debugger 125 } // namespace debugger
129 } // namespace sky 126 } // namespace sky
OLDNEW
« no previous file with comments | « sky/tools/debugger/debugger.h ('k') | sky/tools/tester/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698