// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SAFE_BROWSING_CORE_BROWSER_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST_H_ #define COMPONENTS_SAFE_BROWSING_CORE_BROWSER_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST_H_ #include <memory> #include <string> #include <vector> #include "base/memory/raw_ptr.h" #include "base/memory/raw_ref.h" #include "base/memory/ref_counted_delete_on_sequence.h" #include "base/memory/weak_ptr.h" #include "base/task/cancelable_task_tracker.h" #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_reuse_detector.h" #include "components/safe_browsing/buildflags.h" #include "components/safe_browsing/core/browser/password_protection/metrics_util.h" #include "components/safe_browsing/core/browser/password_protection/request_canceler.h" class GURL; namespace network { class SimpleURLLoader; } namespace safe_browsing { class PasswordProtectionServiceBase; PasswordType; // A request for checking if an unfamiliar login form or a password reuse event // is safe. PasswordProtectionRequest objects are owned by // PasswordProtectionServiceBase indicated by |password_protection_service_|. // PasswordProtectionServiceBase is RefCountedThreadSafe such that it can post // task safely between IO and UI threads. It can only be destroyed on UI thread. // // PasswordProtectionRequest flow: // Step| Thread | Task // (1) | UI | If incognito or !SBER, quit request. // (2) | UI | Add task to IO thread for allowlist checking. // (3) | IO | Check allowlist and return the result back to UI thread. // (4) | UI | If allowlisted, check verdict cache; else quit request. // (5) | UI | If verdict cached, quit request; else prepare request proto. // (6) | UI | Collect features related to the DOM of the page. // (7) | UI | If appropriate, compute visual features of the page. // (7) | UI | Start a timeout task, and send network request. // (8) | UI | On receiving response, handle response and finish. // | | On request timeout, cancel request. // | | On deletion of |password_protection_service_|, cancel request. class PasswordProtectionRequest : public CancelableRequest, public base::RefCountedDeleteOnSequence<PasswordProtectionRequest> { … }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CORE_BROWSER_PASSWORD_PROTECTION_PASSWORD_PROTECTION_REQUEST_H_