OLD | NEW |
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 "chrome/browser/extensions/api/dashboard_private/dashboard_private_api.
h" | 5 #include "chrome/browser/extensions/api/dashboard_private/dashboard_private_api.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 content::WebContents* web_contents = GetAssociatedWebContents(); | 127 content::WebContents* web_contents = GetAssociatedWebContents(); |
128 if (!web_contents) { | 128 if (!web_contents) { |
129 // The browser window has gone away. | 129 // The browser window has gone away. |
130 Respond(BuildResponse(api::dashboard_private::RESULT_USER_CANCELLED, | 130 Respond(BuildResponse(api::dashboard_private::RESULT_USER_CANCELLED, |
131 kUserCancelledError)); | 131 kUserCancelledError)); |
132 // Matches the AddRef in Run(). | 132 // Matches the AddRef in Run(). |
133 Release(); | 133 Release(); |
134 return; | 134 return; |
135 } | 135 } |
136 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt( | 136 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt( |
137 new ExtensionInstallPrompt::Prompt( | 137 new ExtensionInstallPrompt::Prompt( |
138 ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT)); | 138 ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT)); |
139 prompt->set_delegated_username(details().delegated_user); | 139 prompt->set_delegated_username(details().delegated_user); |
140 | 140 |
141 install_prompt_.reset(new ExtensionInstallPrompt(web_contents)); | 141 install_prompt_.reset(new ExtensionInstallPrompt(web_contents)); |
142 install_prompt_->ShowDialog( | 142 install_prompt_->ShowDialog( |
143 base::Bind( | 143 base::Bind( |
144 &DashboardPrivateShowPermissionPromptForDelegatedInstallFunction:: | 144 &DashboardPrivateShowPermissionPromptForDelegatedInstallFunction:: |
145 OnInstallPromptDone, | 145 OnInstallPromptDone, |
146 this), | 146 this), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 api::dashboard_private::Result result, const std::string& error) { | 181 api::dashboard_private::Result result, const std::string& error) { |
182 if (result != api::dashboard_private::RESULT_SUCCESS) | 182 if (result != api::dashboard_private::RESULT_SUCCESS) |
183 return ErrorWithArguments(CreateResults(result), error); | 183 return ErrorWithArguments(CreateResults(result), error); |
184 | 184 |
185 // The web store expects an empty string on success, so don't use | 185 // The web store expects an empty string on success, so don't use |
186 // RESULT_SUCCESS here. | 186 // RESULT_SUCCESS here. |
187 return ArgumentList( | 187 return ArgumentList( |
188 CreateResults(api::dashboard_private::RESULT_EMPTY_STRING)); | 188 CreateResults(api::dashboard_private::RESULT_EMPTY_STRING)); |
189 } | 189 } |
190 | 190 |
191 scoped_ptr<base::ListValue> | 191 std::unique_ptr<base::ListValue> |
192 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::CreateResults( | 192 DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::CreateResults( |
193 api::dashboard_private::Result result) const { | 193 api::dashboard_private::Result result) const { |
194 return ShowPermissionPromptForDelegatedInstall::Results::Create(result); | 194 return ShowPermissionPromptForDelegatedInstall::Results::Create(result); |
195 } | 195 } |
196 | 196 |
197 DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction:: | 197 DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction:: |
198 DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction() | 198 DashboardPrivateShowPermissionPromptForDelegatedBundleInstallFunction() |
199 : chrome_details_(this) { | 199 : chrome_details_(this) { |
200 } | 200 } |
201 | 201 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ? kUserCancelledError | 275 ? kUserCancelledError |
276 : kInvalidBundleError)); | 276 : kInvalidBundleError)); |
277 return; | 277 return; |
278 } | 278 } |
279 | 279 |
280 Respond(NoArguments()); | 280 Respond(NoArguments()); |
281 } | 281 } |
282 | 282 |
283 } // namespace extensions | 283 } // namespace extensions |
284 | 284 |
OLD | NEW |