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

Side by Side Diff: content/shell/renderer/shell_content_renderer_client.cc

Issue 2871523002: Use OnceCallback on Mojo interfaces in //content (Closed)
Patch Set: . Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/shell/renderer/shell_content_renderer_client.h" 5 #include "content/shell/renderer/shell_content_renderer_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 base::Bind(&TestServiceImpl::OnConnectionError, 48 base::Bind(&TestServiceImpl::OnConnectionError,
49 base::Unretained(this))); 49 base::Unretained(this)));
50 } 50 }
51 51
52 ~TestServiceImpl() override {} 52 ~TestServiceImpl() override {}
53 53
54 private: 54 private:
55 void OnConnectionError() { delete this; } 55 void OnConnectionError() { delete this; }
56 56
57 // mojom::TestService: 57 // mojom::TestService:
58 void DoSomething(const DoSomethingCallback& callback) override { 58 void DoSomething(DoSomethingCallback callback) override {
59 // Instead of responding normally, unbind the pipe, write some garbage, 59 // Instead of responding normally, unbind the pipe, write some garbage,
60 // and go away. 60 // and go away.
61 const std::string kBadMessage = "This is definitely not a valid response!"; 61 const std::string kBadMessage = "This is definitely not a valid response!";
62 mojo::ScopedMessagePipeHandle pipe = binding_.Unbind().PassMessagePipe(); 62 mojo::ScopedMessagePipeHandle pipe = binding_.Unbind().PassMessagePipe();
63 MojoResult rv = mojo::WriteMessageRaw( 63 MojoResult rv = mojo::WriteMessageRaw(
64 pipe.get(), kBadMessage.data(), kBadMessage.size(), nullptr, 0, 64 pipe.get(), kBadMessage.data(), kBadMessage.size(), nullptr, 0,
65 MOJO_WRITE_MESSAGE_FLAG_NONE); 65 MOJO_WRITE_MESSAGE_FLAG_NONE);
66 DCHECK_EQ(rv, MOJO_RESULT_OK); 66 DCHECK_EQ(rv, MOJO_RESULT_OK);
67 67
68 // Deletes this. 68 // Deletes this.
69 OnConnectionError(); 69 OnConnectionError();
70 } 70 }
71 71
72 void DoTerminateProcess(const DoTerminateProcessCallback& callback) override { 72 void DoTerminateProcess(DoTerminateProcessCallback callback) override {
73 NOTREACHED(); 73 NOTREACHED();
74 } 74 }
75 75
76 void CreateFolder(const CreateFolderCallback& callback) override { 76 void CreateFolder(CreateFolderCallback callback) override { NOTREACHED(); }
77
78 void GetRequestorName(GetRequestorNameCallback callback) override {
79 std::move(callback).Run("Not implemented.");
80 }
81
82 void CreateSharedBuffer(const std::string& message,
83 CreateSharedBufferCallback callback) override {
77 NOTREACHED(); 84 NOTREACHED();
78 } 85 }
79 86
80 void GetRequestorName(const GetRequestorNameCallback& callback) override {
81 callback.Run("Not implemented.");
82 }
83
84 void CreateSharedBuffer(const std::string& message,
85 const CreateSharedBufferCallback& callback) override {
86 NOTREACHED();
87 }
88
89 mojo::Binding<mojom::TestService> binding_; 87 mojo::Binding<mojom::TestService> binding_;
90 88
91 DISALLOW_COPY_AND_ASSIGN(TestServiceImpl); 89 DISALLOW_COPY_AND_ASSIGN(TestServiceImpl);
92 }; 90 };
93 91
94 void CreateTestService(const service_manager::BindSourceInfo& source_info, 92 void CreateTestService(const service_manager::BindSourceInfo& source_info,
95 mojom::TestServiceRequest request) { 93 mojom::TestServiceRequest request) {
96 // Owns itself. 94 // Owns itself.
97 new TestServiceImpl(std::move(request)); 95 new TestServiceImpl(std::move(request));
98 } 96 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return; 152 return;
155 153
156 static const char kExternalClearKeyKeySystem[] = 154 static const char kExternalClearKeyKeySystem[] =
157 "org.chromium.externalclearkey"; 155 "org.chromium.externalclearkey";
158 key_systems->emplace_back( 156 key_systems->emplace_back(
159 new cdm::ExternalClearKeyProperties(kExternalClearKeyKeySystem)); 157 new cdm::ExternalClearKeyProperties(kExternalClearKeyKeySystem));
160 } 158 }
161 #endif 159 #endif
162 160
163 } // namespace content 161 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698