1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_API_H_
#include <string>
#include "base/optional.h"
#include "base/strings/string16.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h"
#include "components/password_manager/core/browser/bulk_leak_check_service.h"
#include "extensions/browser/extension_function.h"
namespace extensions {
class PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"passwordsPrivate.recordPasswordsPageAccessInSettings",
PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS)
protected:
~PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() override =
default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateChangeSavedPasswordFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.changeSavedPassword",
PASSWORDSPRIVATE_CHANGESAVEDPASSWORD)
protected:
~PasswordsPrivateChangeSavedPasswordFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRemoveSavedPasswordFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.removeSavedPassword",
PASSWORDSPRIVATE_REMOVESAVEDPASSWORD)
protected:
~PasswordsPrivateRemoveSavedPasswordFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRemoveSavedPasswordsFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.removeSavedPasswords",
PASSWORDSPRIVATE_REMOVESAVEDPASSWORDS)
protected:
~PasswordsPrivateRemoveSavedPasswordsFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRemovePasswordExceptionFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.removePasswordException",
PASSWORDSPRIVATE_REMOVEPASSWORDEXCEPTION)
protected:
~PasswordsPrivateRemovePasswordExceptionFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRemovePasswordExceptionsFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.removePasswordExceptions",
PASSWORDSPRIVATE_REMOVEPASSWORDEXCEPTIONS)
protected:
~PasswordsPrivateRemovePasswordExceptionsFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateUndoRemoveSavedPasswordOrExceptionFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION(
"passwordsPrivate.undoRemoveSavedPasswordOrException",
PASSWORDSPRIVATE_UNDOREMOVESAVEDPASSWORDOREXCEPTION)
protected:
~PasswordsPrivateUndoRemoveSavedPasswordOrExceptionFunction() override =
default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRequestPlaintextPasswordFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.requestPlaintextPassword",
PASSWORDSPRIVATE_REQUESTPLAINTEXTPASSWORD)
protected:
~PasswordsPrivateRequestPlaintextPasswordFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void GotPassword(base::Optional<base::string16> password);
};
class PasswordsPrivateGetSavedPasswordListFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getSavedPasswordList",
PASSWORDSPRIVATE_GETSAVEDPASSWORDLIST)
protected:
~PasswordsPrivateGetSavedPasswordListFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void GetList();
void GotList(const PasswordsPrivateDelegate::UiEntries& entries);
};
class PasswordsPrivateGetPasswordExceptionListFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getPasswordExceptionList",
PASSWORDSPRIVATE_GETPASSWORDEXCEPTIONLIST)
protected:
~PasswordsPrivateGetPasswordExceptionListFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void GetList();
void GotList(const PasswordsPrivateDelegate::ExceptionEntries& entries);
};
class PasswordsPrivateMovePasswordsToAccountFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.movePasswordsToAccount",
PASSWORDSPRIVATE_MOVEPASSWORDSTOACCOUNT)
protected:
~PasswordsPrivateMovePasswordsToAccountFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateImportPasswordsFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.importPasswords",
PASSWORDSPRIVATE_IMPORTPASSWORDS)
protected:
~PasswordsPrivateImportPasswordsFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateExportPasswordsFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.exportPasswords",
PASSWORDSPRIVATE_EXPORTPASSWORDS)
protected:
~PasswordsPrivateExportPasswordsFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void ExportRequestCompleted(const std::string& error);
};
class PasswordsPrivateCancelExportPasswordsFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.cancelExportPasswords",
PASSWORDSPRIVATE_CANCELEXPORTPASSWORDS)
protected:
~PasswordsPrivateCancelExportPasswordsFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRequestExportProgressStatusFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.requestExportProgressStatus",
PASSWORDSPRIVATE_REQUESTEXPORTPROGRESSSTATUS)
protected:
~PasswordsPrivateRequestExportProgressStatusFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateIsOptedInForAccountStorageFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.isOptedInForAccountStorage",
PASSWORDSPRIVATE_ISOPTEDINFORACCOUNTSTORAGE)
protected:
~PasswordsPrivateIsOptedInForAccountStorageFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateOptInForAccountStorageFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.optInForAccountStorage",
PASSWORDSPRIVATE_OPTINFORACCOUNTSTORAGE)
protected:
~PasswordsPrivateOptInForAccountStorageFunction() override = default;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateGetCompromisedCredentialsFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getCompromisedCredentials",
PASSWORDSPRIVATE_GETCOMPROMISEDCREDENTIALS)
protected:
~PasswordsPrivateGetCompromisedCredentialsFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateGetWeakCredentialsFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getWeakCredentials",
PASSWORDSPRIVATE_GETWEAKCREDENTIALS)
protected:
~PasswordsPrivateGetWeakCredentialsFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateGetPlaintextInsecurePasswordFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getPlaintextInsecurePassword",
PASSWORDSPRIVATE_GETPLAINTEXTINSECUREPASSWORD)
protected:
~PasswordsPrivateGetPlaintextInsecurePasswordFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void GotCredential(
base::Optional<api::passwords_private::InsecureCredential> credential);
};
class PasswordsPrivateChangeInsecureCredentialFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.changeInsecureCredential",
PASSWORDSPRIVATE_CHANGEINSECURECREDENTIAL)
protected:
~PasswordsPrivateChangeInsecureCredentialFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateRemoveInsecureCredentialFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.removeInsecureCredential",
PASSWORDSPRIVATE_REMOVEINSECURECREDENTIAL)
protected:
~PasswordsPrivateRemoveInsecureCredentialFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateStartPasswordCheckFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.startPasswordCheck",
PASSWORDSPRIVATE_STARTPASSWORDCHECK)
protected:
~PasswordsPrivateStartPasswordCheckFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
private:
void OnStarted(password_manager::BulkLeakCheckService::State state);
};
class PasswordsPrivateStopPasswordCheckFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.stopPasswordCheck",
PASSWORDSPRIVATE_STOPPASSWORDCHECK)
protected:
~PasswordsPrivateStopPasswordCheckFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
class PasswordsPrivateGetPasswordCheckStatusFunction
: public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("passwordsPrivate.getPasswordCheckStatus",
PASSWORDSPRIVATE_GETPASSWORDCHECKSTATUS)
protected:
~PasswordsPrivateGetPasswordCheckStatusFunction() override;
// ExtensionFunction overrides.
ResponseAction Run() override;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_API_H_
|