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

Side by Side Diff: mojo/shell/package_manager/content_handler_connection.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 "mojo/shell/package_manager/content_handler_connection.h" 5 #include "mojo/shell/package_manager/content_handler_connection.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 20 matching lines...) Expand all
31 ServiceProviderPtr services; 31 ServiceProviderPtr services;
32 32
33 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams); 33 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
34 params->set_source(source); 34 params->set_source(source);
35 params->SetTarget(identity_); 35 params->SetTarget(identity_);
36 params->set_services(GetProxy(&services)); 36 params->set_services(GetProxy(&services));
37 manager->ConnectToApplication(std::move(params)); 37 manager->ConnectToApplication(std::move(params));
38 38
39 MessagePipe pipe; 39 MessagePipe pipe;
40 content_handler_.Bind( 40 content_handler_.Bind(
41 InterfacePtrInfo<ContentHandler>(std::move(pipe.handle0), 0u)); 41 InterfacePtrInfo<mojom::ContentHandler>(std::move(pipe.handle0), 0u));
42 services->ConnectToService(ContentHandler::Name_, std::move(pipe.handle1)); 42 services->ConnectToService(mojom::ContentHandler::Name_,
43 std::move(pipe.handle1));
43 content_handler_.set_connection_error_handler( 44 content_handler_.set_connection_error_handler(
44 [this]() { CloseConnection(); }); 45 [this]() { CloseConnection(); });
45 } 46 }
46 47
47 void ContentHandlerConnection::StartApplication( 48 void ContentHandlerConnection::StartApplication(
48 InterfaceRequest<Application> request, 49 InterfaceRequest<mojom::Application> request,
49 URLResponsePtr response) { 50 URLResponsePtr response) {
50 content_handler_->StartApplication( 51 content_handler_->StartApplication(
51 std::move(request), std::move(response), 52 std::move(request), std::move(response),
52 base::Bind(&ContentHandlerConnection::ApplicationDestructed, 53 base::Bind(&ContentHandlerConnection::ApplicationDestructed,
53 base::Unretained(this))); 54 base::Unretained(this)));
54 ref_count_++; 55 ref_count_++;
55 } 56 }
56 57
57 void ContentHandlerConnection::CloseConnection() { 58 void ContentHandlerConnection::CloseConnection() {
58 if (connection_closed_) 59 if (connection_closed_)
59 return; 60 return;
60 connection_closed_ = true; 61 connection_closed_ = true;
61 connection_closed_callback_.Run(this); 62 connection_closed_callback_.Run(this);
62 delete this; 63 delete this;
63 } 64 }
64 65
65 ContentHandlerConnection::~ContentHandlerConnection() { 66 ContentHandlerConnection::~ContentHandlerConnection() {
66 // If this DCHECK fails then something has tried to delete this object without 67 // If this DCHECK fails then something has tried to delete this object without
67 // calling CloseConnection. 68 // calling CloseConnection.
68 DCHECK(connection_closed_); 69 DCHECK(connection_closed_);
69 } 70 }
70 71
71 void ContentHandlerConnection::ApplicationDestructed() { 72 void ContentHandlerConnection::ApplicationDestructed() {
72 if (!--ref_count_) 73 if (!--ref_count_)
73 CloseConnection(); 74 CloseConnection();
74 } 75 }
75 76
76 } // namespace shell 77 } // namespace shell
77 } // namespace mojo 78 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/package_manager/content_handler_connection.h ('k') | mojo/shell/package_manager/content_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698