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

Side by Side Diff: content/browser/mojo/mojo_shell_context.cc

Issue 1209283003: FrameMojoShell provides services to mojo apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/mojo/mojo_shell_context.h" 5 #include "content/browser/mojo/mojo_shell_context.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 public: 82 public:
83 Proxy(MojoShellContext* shell_context) 83 Proxy(MojoShellContext* shell_context)
84 : shell_context_(shell_context), 84 : shell_context_(shell_context),
85 task_runner_(base::ThreadTaskRunnerHandle::Get()) {} 85 task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
86 86
87 ~Proxy() {} 87 ~Proxy() {}
88 88
89 void ConnectToApplication( 89 void ConnectToApplication(
90 const GURL& url, 90 const GURL& url,
91 const GURL& requestor_url, 91 const GURL& requestor_url,
92 mojo::InterfaceRequest<mojo::ServiceProvider> request) { 92 mojo::InterfaceRequest<mojo::ServiceProvider> request,
93 mojo::ServiceProviderPtr exposed_services) {
93 if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) { 94 if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) {
94 if (shell_context_) 95 if (shell_context_) {
95 shell_context_->ConnectToApplicationOnOwnThread(url, requestor_url, 96 shell_context_->ConnectToApplicationOnOwnThread(
96 request.Pass()); 97 url, requestor_url, request.Pass(), exposed_services.Pass());
98 }
97 } else { 99 } else {
98 // |shell_context_| outlives the main MessageLoop, so it's safe for it to 100 // |shell_context_| outlives the main MessageLoop, so it's safe for it to
99 // be unretained here. 101 // be unretained here.
100 task_runner_->PostTask( 102 task_runner_->PostTask(
101 FROM_HERE, 103 FROM_HERE,
102 base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread, 104 base::Bind(&MojoShellContext::ConnectToApplicationOnOwnThread,
103 base::Unretained(shell_context_), url, requestor_url, 105 base::Unretained(shell_context_), url, requestor_url,
104 base::Passed(&request))); 106 base::Passed(&request), base::Passed(&exposed_services)));
105 } 107 }
106 } 108 }
107 109
108 private: 110 private:
109 MojoShellContext* shell_context_; 111 MojoShellContext* shell_context_;
110 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 112 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
111 113
112 DISALLOW_COPY_AND_ASSIGN(Proxy); 114 DISALLOW_COPY_AND_ASSIGN(Proxy);
113 }; 115 };
114 116
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #endif 153 #endif
152 } 154 }
153 155
154 MojoShellContext::~MojoShellContext() { 156 MojoShellContext::~MojoShellContext() {
155 } 157 }
156 158
157 // static 159 // static
158 void MojoShellContext::ConnectToApplication( 160 void MojoShellContext::ConnectToApplication(
159 const GURL& url, 161 const GURL& url,
160 const GURL& requestor_url, 162 const GURL& requestor_url,
161 mojo::InterfaceRequest<mojo::ServiceProvider> request) { 163 mojo::InterfaceRequest<mojo::ServiceProvider> request,
162 proxy_.Get()->ConnectToApplication(url, requestor_url, request.Pass()); 164 mojo::ServiceProviderPtr exposed_services) {
165 proxy_.Get()->ConnectToApplication(url, requestor_url, request.Pass(),
166 exposed_services.Pass());
163 } 167 }
164 168
165 void MojoShellContext::ConnectToApplicationOnOwnThread( 169 void MojoShellContext::ConnectToApplicationOnOwnThread(
166 const GURL& url, 170 const GURL& url,
167 const GURL& requestor_url, 171 const GURL& requestor_url,
168 mojo::InterfaceRequest<mojo::ServiceProvider> request) { 172 mojo::InterfaceRequest<mojo::ServiceProvider> request,
173 mojo::ServiceProviderPtr exposed_services) {
169 mojo::URLRequestPtr url_request = mojo::URLRequest::New(); 174 mojo::URLRequestPtr url_request = mojo::URLRequest::New();
170 url_request->url = mojo::String::From(url); 175 url_request->url = mojo::String::From(url);
171 application_manager_->ConnectToApplication( 176 application_manager_->ConnectToApplication(
172 url_request.Pass(), requestor_url, request.Pass(), 177 url_request.Pass(), requestor_url, request.Pass(),
173 mojo::ServiceProviderPtr(), base::Bind(&base::DoNothing)); 178 exposed_services.Pass(), base::Bind(&base::DoNothing));
174 } 179 }
175 180
176 GURL MojoShellContext::ResolveMappings(const GURL& url) { 181 GURL MojoShellContext::ResolveMappings(const GURL& url) {
177 return url; 182 return url;
178 } 183 }
179 184
180 GURL MojoShellContext::ResolveMojoURL(const GURL& url) { 185 GURL MojoShellContext::ResolveMojoURL(const GURL& url) {
181 return url; 186 return url;
182 } 187 }
183 188
184 bool MojoShellContext::CreateFetcher( 189 bool MojoShellContext::CreateFetcher(
185 const GURL& url, 190 const GURL& url,
186 const mojo::shell::Fetcher::FetchCallback& loader_callback) { 191 const mojo::shell::Fetcher::FetchCallback& loader_callback) {
187 return false; 192 return false;
188 } 193 }
189 194
190 } // namespace content 195 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_shell_context.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698