-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapp_browser_minimal.cc
59 lines (45 loc) · 1.55 KB
/
app_browser_minimal.cc
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
// 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.
#include "examples/minimal/client_minimal.h"
#include "examples/shared/app_factory.h"
#include "examples/shared/browser_util.h"
namespace minimal {
namespace {
const char kStartupURL[] = "https://www.google.com";
} // namespace
// Minimal implementation of CefApp for the browser process.
class BrowserApp : public CefApp, public CefBrowserProcessHandler {
public:
BrowserApp() {}
// CefApp methods:
CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override {
return this;
}
void OnBeforeCommandLineProcessing(
const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) override {
// Command-line flags can be modified in this callback.
// |process_type| is empty for the browser process.
if (process_type.empty()) {
#if defined(OS_MACOSX)
// Disable the macOS keychain prompt. Cookies will not be encrypted.
command_line->AppendSwitch("use-mock-keychain");
#endif
}
}
// CefBrowserProcessHandler methods:
void OnContextInitialized() override {
// Create the browser window.
shared::CreateBrowser(new Client(), kStartupURL, CefBrowserSettings());
}
private:
IMPLEMENT_REFCOUNTING(BrowserApp);
DISALLOW_COPY_AND_ASSIGN(BrowserApp);
};
} // namespace minimal
namespace shared {
CefRefPtr<CefApp> CreateBrowserProcessApp() {
return new minimal::BrowserApp();
}
} // namespace shared