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: mandoline/services/core_services/core_services_application_delegate.cc

Issue 1679573002: Move shell interfaces into the shell.mojom namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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 "mandoline/services/core_services/core_services_application_delegate.h" 5 #include "mandoline/services/core_services/core_services_application_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace core_services { 27 namespace core_services {
28 28
29 // A helper class for hosting a mojo::ApplicationImpl on its own thread. 29 // A helper class for hosting a mojo::ApplicationImpl on its own thread.
30 class ApplicationThread : public base::SimpleThread { 30 class ApplicationThread : public base::SimpleThread {
31 public: 31 public:
32 ApplicationThread(const base::WeakPtr<CoreServicesApplicationDelegate> 32 ApplicationThread(const base::WeakPtr<CoreServicesApplicationDelegate>
33 core_services_application, 33 core_services_application,
34 const std::string& url, 34 const std::string& url,
35 scoped_ptr<mojo::ApplicationDelegate> delegate, 35 scoped_ptr<mojo::ApplicationDelegate> delegate,
36 mojo::InterfaceRequest<mojo::Application> request, 36 mojo::ApplicationRequest request,
37 const mojo::Callback<void()>& destruct_callback) 37 const mojo::Callback<void()>& destruct_callback)
38 : base::SimpleThread(url), 38 : base::SimpleThread(url),
39 core_services_application_(core_services_application), 39 core_services_application_(core_services_application),
40 core_services_application_task_runner_(base::MessageLoop::current() 40 core_services_application_task_runner_(base::MessageLoop::current()
41 ->task_runner()), 41 ->task_runner()),
42 url_(url), 42 url_(url),
43 delegate_(std::move(delegate)), 43 delegate_(std::move(delegate)),
44 request_(std::move(request)), 44 request_(std::move(request)),
45 destruct_callback_(destruct_callback) {} 45 destruct_callback_(destruct_callback) {}
46 46
(...skipping 19 matching lines...) Expand all
66 core_services_application_, 66 core_services_application_,
67 this)); 67 this));
68 } 68 }
69 69
70 private: 70 private:
71 base::WeakPtr<CoreServicesApplicationDelegate> core_services_application_; 71 base::WeakPtr<CoreServicesApplicationDelegate> core_services_application_;
72 scoped_refptr<base::SingleThreadTaskRunner> 72 scoped_refptr<base::SingleThreadTaskRunner>
73 core_services_application_task_runner_; 73 core_services_application_task_runner_;
74 std::string url_; 74 std::string url_;
75 scoped_ptr<mojo::ApplicationDelegate> delegate_; 75 scoped_ptr<mojo::ApplicationDelegate> delegate_;
76 mojo::InterfaceRequest<mojo::Application> request_; 76 mojo::ApplicationRequest request_;
77 mojo::Callback<void()> destruct_callback_; 77 mojo::Callback<void()> destruct_callback_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(ApplicationThread); 79 DISALLOW_COPY_AND_ASSIGN(ApplicationThread);
80 }; 80 };
81 81
82 CoreServicesApplicationDelegate::CoreServicesApplicationDelegate() 82 CoreServicesApplicationDelegate::CoreServicesApplicationDelegate()
83 : weak_factory_(this) { 83 : weak_factory_(this) {
84 } 84 }
85 85
86 CoreServicesApplicationDelegate::~CoreServicesApplicationDelegate() { 86 CoreServicesApplicationDelegate::~CoreServicesApplicationDelegate() {
(...skipping 23 matching lines...) Expand all
110 110
111 void CoreServicesApplicationDelegate::Quit() { 111 void CoreServicesApplicationDelegate::Quit() {
112 // This will delete all threads. This also performs a blocking join, waiting 112 // This will delete all threads. This also performs a blocking join, waiting
113 // for the threads to end. 113 // for the threads to end.
114 application_threads_.clear(); 114 application_threads_.clear();
115 weak_factory_.InvalidateWeakPtrs(); 115 weak_factory_.InvalidateWeakPtrs();
116 } 116 }
117 117
118 void CoreServicesApplicationDelegate::Create( 118 void CoreServicesApplicationDelegate::Create(
119 mojo::ApplicationConnection* connection, 119 mojo::ApplicationConnection* connection,
120 mojo::InterfaceRequest<mojo::ContentHandler> request) { 120 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) {
121 handler_bindings_.AddBinding(this, std::move(request)); 121 handler_bindings_.AddBinding(this, std::move(request));
122 } 122 }
123 123
124 void CoreServicesApplicationDelegate::StartApplication( 124 void CoreServicesApplicationDelegate::StartApplication(
125 mojo::InterfaceRequest<mojo::Application> request, 125 mojo::ApplicationRequest request,
126 mojo::URLResponsePtr response, 126 mojo::URLResponsePtr response,
127 const mojo::Callback<void()>& destruct_callback) { 127 const mojo::Callback<void()>& destruct_callback) {
128 const std::string url = response->url; 128 const std::string url = response->url;
129 129
130 scoped_ptr<mojo::ApplicationDelegate> delegate; 130 scoped_ptr<mojo::ApplicationDelegate> delegate;
131 if (url == "mojo://clipboard/") { 131 if (url == "mojo://clipboard/") {
132 delegate.reset(new clipboard::ClipboardApplicationDelegate); 132 delegate.reset(new clipboard::ClipboardApplicationDelegate);
133 } else if (url == "mojo://filesystem/") { 133 } else if (url == "mojo://filesystem/") {
134 delegate.reset(new filesystem::FileSystemApp); 134 delegate.reset(new filesystem::FileSystemApp);
135 } else if (url == "mojo://tracing/") { 135 } else if (url == "mojo://tracing/") {
(...skipping 13 matching lines...) Expand all
149 } 149 }
150 150
151 scoped_ptr<ApplicationThread> thread(new ApplicationThread( 151 scoped_ptr<ApplicationThread> thread(new ApplicationThread(
152 weak_factory_.GetWeakPtr(), url, std::move(delegate), std::move(request), 152 weak_factory_.GetWeakPtr(), url, std::move(delegate), std::move(request),
153 destruct_callback)); 153 destruct_callback));
154 thread->Start(); 154 thread->Start();
155 application_threads_.push_back(std::move(thread)); 155 application_threads_.push_back(std::move(thread));
156 } 156 }
157 157
158 } // namespace core_services 158 } // namespace core_services
OLDNEW
« no previous file with comments | « mandoline/services/core_services/core_services_application_delegate.h ('k') | mash/example/window_type_launcher/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698