-
Notifications
You must be signed in to change notification settings - Fork 68
/
client_impl.h
67 lines (54 loc) · 2.27 KB
/
client_impl.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) 2017 The Chromium Embedded Framework 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 CEF_EXAMPLES_RESOURCE_MANAGER_CLIENT_IMPL_H_
#define CEF_EXAMPLES_RESOURCE_MANAGER_CLIENT_IMPL_H_
#include "include/cef_client.h"
#include "include/wrapper/cef_resource_manager.h"
namespace resource_manager {
// Implementation of client handlers.
class Client : public CefClient,
public CefDisplayHandler,
public CefLifeSpanHandler,
public CefRequestHandler,
public CefResourceRequestHandler {
public:
Client();
// CefClient methods:
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override { return this; }
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override { return this; }
CefRefPtr<CefRequestHandler> GetRequestHandler() override { return this; }
// CefDisplayHandler methods:
void OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString& title) override;
// CefLifeSpanHandler methods:
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override;
bool DoClose(CefRefPtr<CefBrowser> browser) override;
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override;
// CefRequestHandler methods:
CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_navigation,
bool is_download,
const CefString& request_initiator,
bool& disable_default_handling) override;
// CefResourceRequestHandler methods:
cef_return_value_t OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefCallback> callback) override;
CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) override;
private:
// Manages the registration and delivery of resources.
CefRefPtr<CefResourceManager> resource_manager_;
IMPLEMENT_REFCOUNTING(Client);
DISALLOW_COPY_AND_ASSIGN(Client);
};
} // namespace resource_manager
#endif // CEF_EXAMPLES_RESOURCE_MANAGER_CLIENT_IMPL_H_