123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // Copyright 2020 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 FUCHSIA_WEB_WEBENGINE_BROWSER_NAVIGATION_POLICY_HANDLER_H_
- #define FUCHSIA_WEB_WEBENGINE_BROWSER_NAVIGATION_POLICY_HANDLER_H_
- #include <fuchsia/web/cpp/fidl.h>
- #include "base/containers/flat_set.h"
- #include "fuchsia_web/webengine/web_engine_export.h"
- class NavigationPolicyThrottle;
- namespace content {
- class NavigationHandle;
- } // namespace content
- class WEB_ENGINE_EXPORT NavigationPolicyHandler {
- public:
- NavigationPolicyHandler(
- fuchsia::web::NavigationPolicyProviderParams params,
- fidl::InterfaceHandle<fuchsia::web::NavigationPolicyProvider> delegate);
- ~NavigationPolicyHandler();
- NavigationPolicyHandler(const NavigationPolicyHandler&) = delete;
- NavigationPolicyHandler& operator=(const NavigationPolicyHandler&) = delete;
- void RegisterNavigationThrottle(
- NavigationPolicyThrottle* navigation_throttle);
- void RemoveNavigationThrottle(NavigationPolicyThrottle* navigation_throttle);
- bool is_provider_connected();
- // Sends the request to evaluate the `requested_navigation` to the
- // `NavigationPolicyProvider`.
- void EvaluateRequestedNavigation(
- fuchsia::web::RequestedNavigation requested_navigation,
- fuchsia::web::NavigationPolicyProvider::
- EvaluateRequestedNavigationCallback callback);
- // Determines whether or not the client is interested in evaluating |handle|.
- bool ShouldEvaluateNavigation(content::NavigationHandle* handle,
- fuchsia::web::NavigationPhase phase);
- private:
- void OnNavigationPolicyProviderDisconnected(zx_status_t status);
- fuchsia::web::NavigationPolicyProviderParams params_;
- fuchsia::web::NavigationPolicyProviderPtr provider_;
- // Keeps track of the NavigationThrottles associated with the Frame that owns
- // |this|.
- base::flat_set<NavigationPolicyThrottle*> navigation_throttles_;
- };
- #endif // FUCHSIA_WEB_WEBENGINE_BROWSER_NAVIGATION_POLICY_HANDLER_H_
|