forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell_navigation_request.h
52 lines (40 loc) · 1.88 KB
/
shell_navigation_request.h
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
// Copyright 2017 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 HEADLESS_APP_SHELL_NAVIGATION_REQUEST_H_
#define HEADLESS_APP_SHELL_NAVIGATION_REQUEST_H_
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "headless/public/devtools/domains/network.h"
#include "headless/public/util/navigation_request.h"
namespace headless {
class HeadlessShell;
// Used in deterministic mode to make sure navigations and resource requests
// complete in the order requested.
class ShellNavigationRequest : public NavigationRequest {
public:
ShellNavigationRequest(base::WeakPtr<HeadlessShell> headless_shell,
const std::string& interception_id);
~ShellNavigationRequest() override;
void StartProcessing(base::Closure done_callback) override;
private:
static void StartProcessingOnUiThread(
std::unique_ptr<base::WeakPtr<HeadlessShell>> headless_shell,
std::string interception_id,
base::Closure done_callback);
// Note the navigation likely isn't done when this is called, however we
// expect it will have been committed and the initial resource load requested.
static void ContinueInterceptedRequestResult(
base::Closure done_callback,
std::unique_ptr<network::ContinueInterceptedRequestResult>);
static void ContinueInterceptedRequestResultOnIoThread(
base::Closure done_callback);
// Yuck we need to post a weak pointer from the IO -> UI threads but WeakPtr
// is super finicky about which threads it's touched on. By boxing this up in
// a unique_ptr we can pass it about and only touch it on the UI thread.
std::unique_ptr<base::WeakPtr<HeadlessShell>> headless_shell_;
std::string interception_id_;
};
} // namespace headless
#endif // HEADLESS_APP_SHELL_NAVIGATION_REQUEST_H_