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: chrome/browser/extensions/api/passwords_private/passwords_private_api.cc

Issue 1892613006: Add functions to the passwords private api that update the lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add callback 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 "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/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/api/passwords_private/passwords_private_dele gate_factory.h" 8 #include "chrome/browser/extensions/api/passwords_private/passwords_private_dele gate_factory.h"
9 #include "chrome/common/extensions/api/passwords_private.h" 9 #include "chrome/common/extensions/api/passwords_private.h"
10 #include "components/password_manager/core/common/experiments.h" 10 #include "components/password_manager/core/common/experiments.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 delegate->RequestShowPassword(parameters->login_pair.origin_url, 79 delegate->RequestShowPassword(parameters->login_pair.origin_url,
80 parameters->login_pair.username, 80 parameters->login_pair.username,
81 GetSenderWebContents()); 81 GetSenderWebContents());
82 82
83 // No response given from this API function; instead, listeners wait for the 83 // No response given from this API function; instead, listeners wait for the
84 // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire. 84 // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire.
85 return RespondNow(NoArguments()); 85 return RespondNow(NoArguments());
86 } 86 }
87 87
88 ////////////////////////////////////////////////////////////////////////////////
89 // PasswordsPrivateRequestSavedPasswordListFunction
90
91 PasswordsPrivateRequestSavedPasswordListFunction::
92 ~PasswordsPrivateRequestSavedPasswordListFunction() {}
93
94 ExtensionFunction::ResponseAction
95 PasswordsPrivateRequestSavedPasswordListFunction::Run() {
96 PasswordsPrivateDelegate* delegate =
97 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(),
98 true /* create */);
99 std::unique_ptr<base::ListValue> event_args =
100 api::passwords_private::OnSavedPasswordsListChanged::Create(
101 *(delegate->GetSavedPasswordsList()));
102 base::ListValue* entries = nullptr;
103 event_args->GetList(0, &entries);
stevenjb 2016/04/19 20:59:17 I believe that if this is called with no entries a
hcarmona 2016/04/19 23:07:45 I fixed my issue. I was creating an event object a
stevenjb 2016/04/19 23:13:38 Ah. Yes, this is better.
104 return RespondNow(OneArgument(entries->CreateDeepCopy()));
105 }
106
107 ////////////////////////////////////////////////////////////////////////////////
108 // PasswordsPrivateRequestPasswordExceptionListFunction
109
110 PasswordsPrivateRequestPasswordExceptionListFunction::
111 ~PasswordsPrivateRequestPasswordExceptionListFunction() {}
112
113 ExtensionFunction::ResponseAction
114 PasswordsPrivateRequestPasswordExceptionListFunction::Run() {
115 PasswordsPrivateDelegate* delegate =
116 PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(),
117 true /* create */);
118 std::unique_ptr<base::ListValue> event_args =
119 api::passwords_private::OnPasswordExceptionsListChanged::Create(
120 *(delegate->GetPasswordExceptionsList()));
121 base::ListValue* exceptions = nullptr;
122 event_args->GetList(0, &exceptions);
stevenjb 2016/04/19 20:59:17 Same here.
hcarmona 2016/04/19 23:07:45 Same changes here.
123 return RespondNow(OneArgument(exceptions->CreateDeepCopy()));
124 }
125
88 } // namespace extensions 126 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698