使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 479b1995ef435713c2cf4f0da8de3a6af6c30922
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include "Cef3ClientAppBrowser.h"
#include "include/base/cef_logging.h"
#include "include/cef_cookie.h" 
 
namespace browser
{
 
namespace {
 
#if defined DEBUG || defined _DEBUG
const char kSubProcess[] = "mbsubprocess.exe";
#else
const char kSubProcess[] = "mbsubprocess.exe";
#endif
 
}
 
CCef3ClientAppBrowser::CCef3ClientAppBrowser()
{
  CreateDelegates(delegates_); 
 
void CCef3ClientAppBrowser::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
    if (process_type.empty())
    { 
        command_line->AppendSwitch("--disable-gpu");
        command_line->AppendSwitch("--ignore-certificate-errors");
        command_line->AppendSwitch("--no-proxy-server");
        //command_line->AppendSwitch("no-proxy-server");
        command_line->AppendSwitchWithValue("--renderer-process-limit", "1");
        command_line->AppendSwitchWithValue("--browser-subprocess-path", kSubProcess);
        //command_line->AppendSwitch("--enable-media-stream");
        //command_line->AppendSwitch("enable-begin-frame-scheduling");
        command_line->AppendSwitch("--process-per-site");
        command_line->AppendSwitchWithValue("--high-dpi-support","1");
        command_line->AppendSwitchWithValue("--force-device-scale-factor","1");
        //command_line->AppendSwitchWithValue("ppapi-flash-version", "22.0.0.209");//PepperFlash\manifest.json中的version
        //command_line->AppendSwitchWithValue("ppapi-flash-path", "PepperFlash\\pepflashplayer.dll");
 
         
        DelegateSet::iterator it = delegates_.begin();
        for (; it != delegates_.end(); ++it)
            (*it)->OnBeforeCommandLineProcessing(this, command_line);
    }
 
    /*
  // Pass additional command-line flags to the browser process.
  //if (process_type.empty())
  { 
 
    // Pass additional command-line flags when off-screen rendering is enabled.
     
    // If the PDF extension is enabled then cc Surfaces must be disabled for
    // PDFs to render correctly.
    // See https://bitbucket.org/chromiumembedded/cef/issues/1689 for details.
    if (!command_line->HasSwitch("disable-extensions") &&
        !command_line->HasSwitch("disable-pdf-extension"))
    {
      command_line->AppendSwitch("disable-surfaces");
    }
 
    // Use software rendering and compositing (disable GPU) for increased FPS
    // and decreased CPU usage. This will also disable WebGL so remove these
    // switches if you need that capability.
    // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
    command_line->AppendSwitch("disable-gpu");
    command_line->AppendSwitch("disable-gpu-compositing");
    
    // Synchronize the frame rate between all processes. This results in
    // decreased CPU usage by avoiding the generation of extra frames that
    // would otherwise be discarded. The frame rate can be set at browser
    // creation time via CefBrowserSettings.windowless_frame_rate or changed
    // dynamically using CefBrowserHost::SetWindowlessFrameRate. In cefclient
    // it can be set via the command-line using `--off-screen-frame-rate=XX`.
    // See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details.
    command_line->AppendSwitch("enable-begin-frame-scheduling");
 
    command_line->AppendSwitch("--ignore-certificate-errors");
    command_line->AppendSwitch("--no-proxy-server");
 
    // 此参数解决多窗口问题
    //command_line->AppendSwitch("enable-npapi");
    //command_line->AppendSwitchWithValue("register-pepper-plugins", "PepperFlash/pepflashplayer.dll;application/x-shockwave-flash");
 
    
 
  }
  */
}
 
void CCef3ClientAppBrowser::OnContextInitialized()
{
  // Register cookieable schemes with the global cookie manager.
  CefRefPtr<CefCookieManager> manager =
    CefCookieManager::GetGlobalManager(NULL);
  DCHECK(manager.get());
  manager->SetSupportedSchemes(cookieable_schemes_, NULL);
 
  print_handler_ = CreatePrintHandler();
 
  DelegateSet::iterator it = delegates_.begin();
  for (; it != delegates_.end(); ++it)
    (*it)->OnContextInitialized(this);
}
 
void CCef3ClientAppBrowser::OnBeforeChildProcessLaunch(
  CefRefPtr<CefCommandLine> command_line)
{
  DelegateSet::iterator it = delegates_.begin();
  for (; it != delegates_.end(); ++it)
    (*it)->OnBeforeChildProcessLaunch(this, command_line);
}
 
void CCef3ClientAppBrowser::OnRenderProcessThreadCreated(
  CefRefPtr<CefListValue> extra_info)
{
  DelegateSet::iterator it = delegates_.begin();
  for (; it != delegates_.end(); ++it)
    (*it)->OnRenderProcessThreadCreated(this, extra_info);
}
 
 
// static
void CCef3ClientAppBrowser::CreateDelegates(DelegateSet& delegates)
{
 
}
 
// static
CefRefPtr<CefPrintHandler> CCef3ClientAppBrowser::CreatePrintHandler()
{
#if defined(OS_LINUX)
  return new ClientPrintHandlerGtk();
#else
  return NULL;
#endif
}
 
  
 
}  // namespace browser