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

Side by Side Diff: extensions/browser/api/display_source/display_source_api.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "extensions/browser/api/display_source/display_source_api.h" 5 #include "extensions/browser/api/display_source/display_source_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "extensions/browser/api/display_source/display_source_connection_delega te_factory.h" 9 #include "extensions/browser/api/display_source/display_source_connection_delega te_factory.h"
10 #include "extensions/common/api/display_source.h" 10 #include "extensions/common/api/display_source.h"
(...skipping 26 matching lines...) Expand all
37 &DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted, this); 37 &DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted, this);
38 auto failure_callback = base::Bind( 38 auto failure_callback = base::Bind(
39 &DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed, this); 39 &DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed, this);
40 delegate->GetAvailableSinks(success_callback, failure_callback); 40 delegate->GetAvailableSinks(success_callback, failure_callback);
41 41
42 return RespondLater(); 42 return RespondLater();
43 } 43 }
44 44
45 void DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted( 45 void DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted(
46 const DisplaySourceSinkInfoList& sinks) { 46 const DisplaySourceSinkInfoList& sinks) {
47 scoped_ptr<base::ListValue> result = 47 std::unique_ptr<base::ListValue> result =
48 api::display_source::GetAvailableSinks::Results::Create(sinks); 48 api::display_source::GetAvailableSinks::Results::Create(sinks);
49 Respond(ArgumentList(std::move(result))); 49 Respond(ArgumentList(std::move(result)));
50 } 50 }
51 51
52 void DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed( 52 void DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed(
53 const std::string& reason) { 53 const std::string& reason) {
54 Respond(Error(reason)); 54 Respond(Error(reason));
55 } 55 }
56 56
57 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
58 // DisplaySourceRequestAuthenticationFunction 58 // DisplaySourceRequestAuthenticationFunction
59 59
60 DisplaySourceRequestAuthenticationFunction:: 60 DisplaySourceRequestAuthenticationFunction::
61 ~DisplaySourceRequestAuthenticationFunction() {} 61 ~DisplaySourceRequestAuthenticationFunction() {}
62 62
63 ExtensionFunction::ResponseAction 63 ExtensionFunction::ResponseAction
64 DisplaySourceRequestAuthenticationFunction::Run() { 64 DisplaySourceRequestAuthenticationFunction::Run() {
65 scoped_ptr<api::display_source::RequestAuthentication::Params> params( 65 std::unique_ptr<api::display_source::RequestAuthentication::Params> params(
66 api::display_source::RequestAuthentication::Params::Create(*args_)); 66 api::display_source::RequestAuthentication::Params::Create(*args_));
67 if (!params) { 67 if (!params) {
68 return RespondNow(Error(kErrorInvalidArguments)); 68 return RespondNow(Error(kErrorInvalidArguments));
69 } 69 }
70 70
71 DisplaySourceConnectionDelegate* delegate = 71 DisplaySourceConnectionDelegate* delegate =
72 DisplaySourceConnectionDelegateFactory::GetForBrowserContext( 72 DisplaySourceConnectionDelegateFactory::GetForBrowserContext(
73 browser_context()); 73 browser_context());
74 if (!delegate) { 74 if (!delegate) {
75 return RespondNow(Error(kErrorNotSupported)); 75 return RespondNow(Error(kErrorNotSupported));
76 } 76 }
77 77
78 auto success_callback = base::Bind( 78 auto success_callback = base::Bind(
79 &DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted, 79 &DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted,
80 this); 80 this);
81 auto failure_callback = base::Bind( 81 auto failure_callback = base::Bind(
82 &DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed, this); 82 &DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed, this);
83 delegate->RequestAuthentication(params->sink_id, success_callback, 83 delegate->RequestAuthentication(params->sink_id, success_callback,
84 failure_callback); 84 failure_callback);
85 return RespondLater(); 85 return RespondLater();
86 } 86 }
87 87
88 void DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted( 88 void DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted(
89 const DisplaySourceAuthInfo& auth_info) { 89 const DisplaySourceAuthInfo& auth_info) {
90 scoped_ptr<base::ListValue> result = 90 std::unique_ptr<base::ListValue> result =
91 api::display_source::RequestAuthentication::Results::Create(auth_info); 91 api::display_source::RequestAuthentication::Results::Create(auth_info);
92 Respond(ArgumentList(std::move(result))); 92 Respond(ArgumentList(std::move(result)));
93 } 93 }
94 94
95 void DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed( 95 void DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed(
96 const std::string& reason) { 96 const std::string& reason) {
97 Respond(Error(reason)); 97 Respond(Error(reason));
98 } 98 }
99 99
100 } // namespace extensions 100 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698