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

Side by Side Diff: mojo/application/content_handler_factory.h

Issue 2069663002: Some scoped_ptr -> std::unique_ptr conversion, especially under //mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 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 #ifndef MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ 5 #ifndef MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
6 #define MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ 6 #define MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include <memory>
9
9 #include "mojo/public/cpp/application/service_provider_impl.h" 10 #include "mojo/public/cpp/application/service_provider_impl.h"
10 #include "mojo/public/interfaces/application/shell.mojom.h" 11 #include "mojo/public/interfaces/application/shell.mojom.h"
11 #include "mojo/services/content_handler/interfaces/content_handler.mojom.h" 12 #include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
12 #include "mojo/services/network/interfaces/url_loader.mojom.h" 13 #include "mojo/services/network/interfaces/url_loader.mojom.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 struct ConnectionContext; 17 struct ConnectionContext;
17 18
18 // TODO(vtl): Nuke this class. Now it's only a "namespace" for stuff, most of 19 // TODO(vtl): Nuke this class. Now it's only a "namespace" for stuff, most of
(...skipping 15 matching lines...) Expand all
34 URLResponsePtr response) = 0; 35 URLResponsePtr response) = 0;
35 }; 36 };
36 37
37 class ManagedDelegate : public Delegate { 38 class ManagedDelegate : public Delegate {
38 public: 39 public:
39 ~ManagedDelegate() override {} 40 ~ManagedDelegate() override {}
40 // Implement this method to create the Application for the given content. 41 // Implement this method to create the Application for the given content.
41 // This method will be called on a new thread. The application will be run 42 // This method will be called on a new thread. The application will be run
42 // on this new thread, and the returned value will be kept alive until the 43 // on this new thread, and the returned value will be kept alive until the
43 // application ends. 44 // application ends.
44 virtual scoped_ptr<HandledApplicationHolder> CreateApplication( 45 virtual std::unique_ptr<HandledApplicationHolder> CreateApplication(
45 InterfaceRequest<Application> application_request, 46 InterfaceRequest<Application> application_request,
46 URLResponsePtr response) = 0; 47 URLResponsePtr response) = 0;
47 48
48 private: 49 private:
49 void RunApplication(InterfaceRequest<Application> application_request, 50 void RunApplication(InterfaceRequest<Application> application_request,
50 URLResponsePtr response) override; 51 URLResponsePtr response) override;
51 }; 52 };
52 53
53 // For use with |ServiceProviderImpl::AddService<ContentHandler>()|. 54 // For use with |ServiceProviderImpl::AddService<ContentHandler>()|.
54 static ServiceProviderImpl::InterfaceRequestHandler<ContentHandler> 55 static ServiceProviderImpl::InterfaceRequestHandler<ContentHandler>
55 GetInterfaceRequestHandler(Delegate* delegate); 56 GetInterfaceRequestHandler(Delegate* delegate);
56 }; 57 };
57 58
58 template <class A> 59 template <class A>
59 class HandledApplicationHolderImpl 60 class HandledApplicationHolderImpl
60 : public ContentHandlerFactory::HandledApplicationHolder { 61 : public ContentHandlerFactory::HandledApplicationHolder {
61 public: 62 public:
62 explicit HandledApplicationHolderImpl(A* value) : value_(value) {} 63 explicit HandledApplicationHolderImpl(A* value) : value_(value) {}
63 64
64 private: 65 private:
65 scoped_ptr<A> value_; 66 std::unique_ptr<A> value_;
66 }; 67 };
67 68
68 template <class A> 69 template <class A>
69 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> 70 std::unique_ptr<ContentHandlerFactory::HandledApplicationHolder>
70 make_handled_factory_holder(A* value) { 71 make_handled_factory_holder(A* value) {
71 return make_scoped_ptr(new HandledApplicationHolderImpl<A>(value)); 72 return std::unique_ptr<ContentHandlerFactory::HandledApplicationHolder>(
73 new HandledApplicationHolderImpl<A>(value));
72 } 74 }
73 75
74 } // namespace mojo 76 } // namespace mojo
75 77
76 #endif // MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_ 78 #endif // MOJO_APPLICATION_CONTENT_HANDLER_FACTORY_H_
OLDNEW
« no previous file with comments | « mojo/android/system/core_impl.cc ('k') | mojo/converters/native_viewport/surface_configuration_type_converters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698