blob: 5734c6d8158a6efa80488cac79c8326a0b220324 [file] [log] [blame]
danakjc492bf82020-09-09 20:02:441// Copyright 2019 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
5#ifndef CONTENT_BROWSER_RENDERER_HOST_IPC_UTILS_H_
6#define CONTENT_BROWSER_RENDERER_HOST_IPC_UTILS_H_
7
8#include "base/memory/ref_counted.h"
9#include "content/common/frame.mojom.h"
10#include "content/common/navigation_params.mojom.h"
11#include "services/network/public/cpp/shared_url_loader_factory.h"
12#include "third_party/blink/public/mojom/frame/frame.mojom.h"
13#include "url/gurl.h"
14
15namespace content {
16
17class SiteInstance;
18
19// Verifies that |params| are valid and can be accessed by the renderer process
20// associated with |site_instance|.
21//
22// If the |params| are valid, returns true.
23//
24// Otherwise, terminates the renderer associated with |site_instance| and
25// returns false.
26//
27// This function has to be called on the UI thread.
28bool VerifyDownloadUrlParams(SiteInstance* site_instance,
29 const blink::mojom::DownloadURLParams& params);
30
31// Verifies that |params| are valid and can be accessed by the renderer process
32// associated with |site_instance|.
33//
34// Returns true if the |params| are valid. As a side-effect of the verification
35// |out_validated_url| and |out_blob_url_loader_factory| will be populated.
36//
37// Terminates the renderer the process associated with |site_instance| and
38// returns false if the |params| are invalid.
39//
40// This function has to be called on the UI thread.
41bool VerifyOpenURLParams(SiteInstance* site_instance,
42 const mojom::OpenURLParamsPtr& params,
43 GURL* out_validated_url,
44 scoped_refptr<network::SharedURLLoaderFactory>*
45 out_blob_url_loader_factory);
46
47// Verifies that CommonNavigationParams are valid and can be accessed by the
48// renderer process associated with |site_instance|.
49//
50// Returns true if the CommonNavigationParams are valid. As a side-effect of
51// the verification parts of |common_params| will be rewritten (e.g. some
52// URLs will be filtered).
53//
54// Terminates the renderer the process associated with |site_instance| and
55// returns false if the CommonNavigationParams are invalid.
56//
57// This function has to be called on the UI thread.
58bool VerifyBeginNavigationCommonParams(
59 SiteInstance* site_instance,
60 mojom::CommonNavigationParams* common_params);
61
62} // namespace content
63
64#endif // CONTENT_BROWSER_RENDERER_HOST_IPC_UTILS_H_