Chromium Code Reviews| Index: chrome/browser/extensions/api/passwords_private/passwords_private_api.cc |
| diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc |
| index ce1128ab807c846af805e19541329ea36a7b229d..a20a8f278dd1140711b2cab91cfe4fafe2169be3 100644 |
| --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc |
| +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc |
| @@ -5,7 +5,10 @@ |
| #include "chrome/browser/extensions/api/passwords_private/passwords_private_api.h" |
| #include "base/values.h" |
| +#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h" |
| #include "chrome/common/extensions/api/passwords_private.h" |
| +#include "components/password_manager/core/common/experiments.h" |
| +#include "content/public/browser/web_contents.h" |
| #include "extensions/browser/extension_function_registry.h" |
| namespace extensions { |
| @@ -18,9 +21,9 @@ PasswordsPrivateCanPasswordAccountBeManagedFunction:: |
| ExtensionFunction::ResponseAction |
| PasswordsPrivateCanPasswordAccountBeManagedFunction::Run() { |
| - // TODO(khorimoto): Implement. |
| - |
| - return RespondNow(NoArguments()); |
| + scoped_ptr<base::FundamentalValue> visible(new base::FundamentalValue( |
| + password_manager::ManageAccountLinkExperimentEnabled())); |
| + return RespondNow(OneArgument(visible.Pass())); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -36,7 +39,11 @@ ExtensionFunction::ResponseAction |
| Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
| - // TODO(khorimoto): Implement. |
| + PasswordsPrivateDelegate* delegate = |
| + PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
| + delegate->RemoveSavedPassword( |
| + parameters->login_pair.origin_url, |
| + parameters->login_pair.username); |
| return RespondNow(NoArguments()); |
| } |
| @@ -54,26 +61,37 @@ ExtensionFunction::ResponseAction |
| Params::Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
| - // TODO(khorimoto): Implement. |
| + PasswordsPrivateDelegate* delegate = |
| + PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
| + delegate->RemovePasswordException(parameters->exception_url); |
| return RespondNow(NoArguments()); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| -// PasswordsPrivateGetPlaintextPasswordFunction |
| +// PasswordsPrivateRequestPlaintextPasswordFunction |
| -PasswordsPrivateGetPlaintextPasswordFunction:: |
| - ~PasswordsPrivateGetPlaintextPasswordFunction() {} |
| +PasswordsPrivateRequestPlaintextPasswordFunction:: |
| + ~PasswordsPrivateRequestPlaintextPasswordFunction() {} |
| ExtensionFunction::ResponseAction |
| - PasswordsPrivateGetPlaintextPasswordFunction::Run() { |
| - scoped_ptr<api::passwords_private::GetPlaintextPassword::Params> |
| - parameters = api::passwords_private::GetPlaintextPassword::Params:: |
| + PasswordsPrivateRequestPlaintextPasswordFunction::Run() { |
| + scoped_ptr<api::passwords_private::RequestPlaintextPassword::Params> |
| + parameters = api::passwords_private::RequestPlaintextPassword::Params:: |
| Create(*args_); |
| EXTENSION_FUNCTION_VALIDATE(parameters.get()); |
| - // TODO(khorimoto): Implement. |
| + PasswordsPrivateDelegate* delegate = |
| + PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context()); |
| + |
| + delegate->RequestShowPassword( |
| + parameters->login_pair.origin_url, |
| + parameters->login_pair.username, |
| + content::WebContents::FromRenderViewHost(render_view_host()) |
| + ->GetTopLevelNativeWindow()); |
|
stevenjb
2015/06/01 21:31:57
It's kind of a minor thing, but I think I would pr
Kyle Horimoto
2015/06/01 22:01:11
Done.
|
| + // No response given from this API function; instead, listeners wait for the |
| + // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire. |
| return RespondNow(NoArguments()); |
| } |