-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathapp_browser_impl.cc
62 lines (48 loc) · 1.67 KB
/
app_browser_impl.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
60
61
62
// 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/resource_manager/client_impl.h"
#include "examples/shared/app_factory.h"
#include "examples/shared/browser_util.h"
#include "examples/shared/resource_util.h"
namespace resource_manager {
namespace {
std::string GetStartupURL() {
return shared::kTestOrigin + std::string("resource_manager.html");
}
} // namespace
// 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(), GetStartupURL(), CefBrowserSettings());
}
private:
IMPLEMENT_REFCOUNTING(BrowserApp);
DISALLOW_COPY_AND_ASSIGN(BrowserApp);
};
} // namespace resource_manager
namespace shared {
CefRefPtr<CefApp> CreateBrowserProcessApp() {
return new resource_manager::BrowserApp();
}
} // namespace shared