CEF(Chromium Embedded Framework)user_agent bug?c ++

时间:2016-05-24 03:25:23

标签: c++ user-agent chromium chromium-embedded

我的代码是例如:

textProperty()

但是在

// Returns the application settings based on command line arguments.
void AppGetSettings(CefSettings& settings) {
  ASSERT(g_command_line.get());
if (!g_command_line.get())
   return;
  CefString str;
#if defined(OS_WIN)
  settings.multi_threaded_message_loop =
      g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop);
#endif

CefString(&settings.locale).FromASCII("zh-cn");
  SystemSetting ss;

  CefString(&settings.cache_path) = L"cache";
  // Specify a port to enable DevTools if one isn't already specified.
  if (!g_command_line->HasSwitch("remote-debugging-port"))
     settings.remote_debugging_port = 8088;

std::wstring wversion = ss.ReadConfigSection(L"version", L"currentVersion");
  std::string version;
  CommonUtil::WStringToString(wversion, version);
  std::string tempStr = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.138 Safari/537.36 testuser_agent/";
  tempStr = tempStr.append(version);
  CefString(&settings.user_agent).FromString(tempStr);

  std::wstring logSeverity = ss.ReadConfigSection(L"config", L"logSeverity");
  if (!logSeverity.empty())
  {
     if (logSeverity == L"LOGSEVERITY_DEFAULT")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_DEFAULT;
     else if (logSeverity == L"LOGSEVERITY_VERBOSE")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_VERBOSE;
     else if (logSeverity == L"LOGSEVERITY_INFO")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_INFO;
     else if (logSeverity == L"LOGSEVERITY_WARNING")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_WARNING;
     else if (logSeverity == L"LOGSEVERITY_ERROR")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_ERROR;
     else if (logSeverity == L"LOGSEVERITY_DISABLE")
        settings.log_severity = cef_log_severity_t::LOGSEVERITY_DISABLE;
  }
  else
     settings.log_severity = cef_log_severity_t::LOGSEVERITY_DISABLE;

  if (g_command_line->HasSwitch(cefclient::kOffScreenRenderingEnabled))
    settings.windowless_rendering_enabled = true;
}

失败了,但其他版本成功了,这是CEF的一个错误?     CefString(安培; settings.user_agent).FromString(tempStr); 这是在其他版本中取得成功,是我的错误吗?但为什么只有这一个失败?我寻找了很多材料,但是没有帮助?谁能帮助我,非常感谢!

0 个答案:

没有答案