password_manager_client_bridge.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PASSWORD_MANAGER_IOS_PASSWORD_MANAGER_CLIENT_BRIDGE_H_
  5. #define COMPONENTS_PASSWORD_MANAGER_IOS_PASSWORD_MANAGER_CLIENT_BRIDGE_H_
  6. #import <Foundation/Foundation.h>
  7. #include <memory>
  8. #include <string>
  9. #include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
  10. class GURL;
  11. namespace password_manager {
  12. class PasswordFormManagerForUI;
  13. class PasswordManager;
  14. } // namespace password_manager
  15. namespace safe_browsing {
  16. enum class WarningAction;
  17. } // namespace safe_browsing
  18. namespace web {
  19. class WebState;
  20. } // namespace web
  21. using password_manager::CredentialLeakType;
  22. // C++ to ObjC bridge for methods of PasswordManagerClient.
  23. @protocol PasswordManagerClientBridge
  24. @property(readonly, nonatomic) web::WebState* webState;
  25. @property(readonly, nonatomic)
  26. password_manager::PasswordManager* passwordManager;
  27. @property(readonly, nonatomic) const GURL& lastCommittedURL;
  28. // Shows UI to prompt the user to save the password.
  29. - (void)showSavePasswordInfoBar:
  30. (std::unique_ptr<password_manager::PasswordFormManagerForUI>)
  31. formToSave
  32. manual:(BOOL)manual;
  33. // Shows UI to prompt the user to update the password.
  34. - (void)showUpdatePasswordInfoBar:
  35. (std::unique_ptr<password_manager::PasswordFormManagerForUI>)
  36. formToUpdate
  37. manual:(BOOL)manual;
  38. // Removes the saving/updating password Infobar from the InfobarManager.
  39. // This also causes the UI to be dismissed.
  40. - (void)removePasswordInfoBarManualFallback:(BOOL)manual;
  41. // Shows Password Breach for |URL|, |leakType|, and |username|.
  42. - (void)showPasswordBreachForLeakType:(CredentialLeakType)leakType
  43. URL:(const GURL&)URL
  44. username:(const std::u16string&)username;
  45. // Shows Password Protection warning with |warningText|. |completion| should be
  46. // called when the UI is dismissed with the user's |action|.
  47. - (void)showPasswordProtectionWarning:(NSString*)warningText
  48. completion:(void (^)(safe_browsing::WarningAction))
  49. completion;
  50. @end
  51. #endif // COMPONENTS_PASSWORD_MANAGER_IOS_PASSWORD_MANAGER_CLIENT_BRIDGE_H_