| 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/passwords_private/passwords_private_api.
h" | 5 #include "chrome/browser/extensions/api/passwords_private/passwords_private_api.
h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ExtensionFunction::ResponseAction | 26 ExtensionFunction::ResponseAction |
| 27 PasswordsPrivateRemoveSavedPasswordFunction::Run() { | 27 PasswordsPrivateRemoveSavedPasswordFunction::Run() { |
| 28 std::unique_ptr<api::passwords_private::RemoveSavedPassword::Params> | 28 std::unique_ptr<api::passwords_private::RemoveSavedPassword::Params> |
| 29 parameters = | 29 parameters = |
| 30 api::passwords_private::RemoveSavedPassword::Params::Create(*args_); | 30 api::passwords_private::RemoveSavedPassword::Params::Create(*args_); |
| 31 EXTENSION_FUNCTION_VALIDATE(parameters.get()); | 31 EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
| 32 | 32 |
| 33 PasswordsPrivateDelegate* delegate = | 33 PasswordsPrivateDelegate* delegate = |
| 34 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), | 34 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), |
| 35 true /* create */); | 35 true /* create */); |
| 36 delegate->RemoveSavedPassword( | 36 delegate->RemoveSavedPassword(parameters->login_pair.urls.origin, |
| 37 parameters->login_pair.origin_url, | 37 parameters->login_pair.username); |
| 38 parameters->login_pair.username); | |
| 39 | 38 |
| 40 return RespondNow(NoArguments()); | 39 return RespondNow(NoArguments()); |
| 41 } | 40 } |
| 42 | 41 |
| 43 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 44 // PasswordsPrivateRemovePasswordExceptionFunction | 43 // PasswordsPrivateRemovePasswordExceptionFunction |
| 45 | 44 |
| 46 PasswordsPrivateRemovePasswordExceptionFunction:: | 45 PasswordsPrivateRemovePasswordExceptionFunction:: |
| 47 ~PasswordsPrivateRemovePasswordExceptionFunction() {} | 46 ~PasswordsPrivateRemovePasswordExceptionFunction() {} |
| 48 | 47 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 73 std::unique_ptr<api::passwords_private::RequestPlaintextPassword::Params> | 72 std::unique_ptr<api::passwords_private::RequestPlaintextPassword::Params> |
| 74 parameters = | 73 parameters = |
| 75 api::passwords_private::RequestPlaintextPassword::Params::Create( | 74 api::passwords_private::RequestPlaintextPassword::Params::Create( |
| 76 *args_); | 75 *args_); |
| 77 EXTENSION_FUNCTION_VALIDATE(parameters.get()); | 76 EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
| 78 | 77 |
| 79 PasswordsPrivateDelegate* delegate = | 78 PasswordsPrivateDelegate* delegate = |
| 80 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), | 79 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), |
| 81 true /* create */); | 80 true /* create */); |
| 82 | 81 |
| 83 delegate->RequestShowPassword(parameters->login_pair.origin_url, | 82 delegate->RequestShowPassword(parameters->login_pair.urls.origin, |
| 84 parameters->login_pair.username, | 83 parameters->login_pair.username, |
| 85 GetSenderWebContents()); | 84 GetSenderWebContents()); |
| 86 | 85 |
| 87 // No response given from this API function; instead, listeners wait for the | 86 // No response given from this API function; instead, listeners wait for the |
| 88 // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire. | 87 // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire. |
| 89 return RespondNow(NoArguments()); | 88 return RespondNow(NoArguments()); |
| 90 } | 89 } |
| 91 | 90 |
| 92 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
| 93 // PasswordsPrivateGetSavedPasswordListFunction | 92 // PasswordsPrivateGetSavedPasswordListFunction |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 138 |
| 140 void PasswordsPrivateGetPasswordExceptionListFunction::GetList() { | 139 void PasswordsPrivateGetPasswordExceptionListFunction::GetList() { |
| 141 PasswordsPrivateDelegate* delegate = | 140 PasswordsPrivateDelegate* delegate = |
| 142 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), | 141 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(), |
| 143 true /* create */); | 142 true /* create */); |
| 144 delegate->GetPasswordExceptionsList(base::Bind( | 143 delegate->GetPasswordExceptionsList(base::Bind( |
| 145 &PasswordsPrivateGetPasswordExceptionListFunction::GotList, this)); | 144 &PasswordsPrivateGetPasswordExceptionListFunction::GotList, this)); |
| 146 } | 145 } |
| 147 | 146 |
| 148 void PasswordsPrivateGetPasswordExceptionListFunction::GotList( | 147 void PasswordsPrivateGetPasswordExceptionListFunction::GotList( |
| 149 const PasswordsPrivateDelegate::ExceptionPairs& list) { | 148 const PasswordsPrivateDelegate::ExceptionEntries& entries) { |
| 150 Respond(ArgumentList( | 149 Respond(ArgumentList( |
| 151 api::passwords_private::GetPasswordExceptionList::Results::Create(list))); | 150 api::passwords_private::GetPasswordExceptionList::Results::Create( |
| 151 entries))); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace extensions | 154 } // namespace extensions |
| OLD | NEW |