我坚持从chrome嵌入式框架3.2704.1416扩展SimpleApp并且无法理解它:(
我尝试在本地添加pepflashplayer.dll
以防止版本与系统范围内安装的dll不匹配,因此我需要通过实现CefApp:OnBeforeCommandLineProcessing
添加一些命令行开关。到目前为止,我的代码基于Web上的示例以及同一示例项目中implementation的CefBrowserProcessHandler::OnContextInitialized
。
在文件simple_app.h中我添加了OnBeforeCommandLineProcessing的声明:
// Copyright (c) 2013 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_TESTS_CEFSIMPLE_SIMPLE_APP_H_
#define CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_
#include "include/cef_app.h"
// Implement application-level callbacks for the browser process.
class SimpleApp : public CefApp,
public CefBrowserProcessHandler {
public:
SimpleApp();
// CefApp methods:
virtual void OnBeforeCommandLineProcessing(const CefString &process_type,
CefRefPtr<CefCommandLine> command_line)
OVERRIDE;
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler()
OVERRIDE { return this; }
// CefBrowserProcessHandler methods:
virtual void OnContextInitialized() OVERRIDE;
private:
// Include the default reference counting implementation.
IMPLEMENT_REFCOUNTING(SimpleApp);
};
#endif // CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_
在文件simple_app.cc中,我根据SimpleApp::OnContextInitialized
的实现添加了新函数的主体:
void SimpleApp::OnBeforeCommandLineProcessing(const CefString& process_type,
CefRefPtr<CefCommandLine> command_line) {
command_line->AppendSwitchWithValue(CefString("ppapi-flash-path"),
CefString("pepflashplayer32_21_0_0_242.dll"));
command_line->AppendSwitchWithValue(CefString("ppapi-flash-version"),
CefString("21.0.0.242"));
#ifdef NDEBUG
command_line->AppendSwitchWithValue(CefString("log-severity"), CefString("disabled"));
#endif
}
void SimpleApp::OnContextInitialized() {
CEF_REQUIRE_UI_THREAD();
// [...]
}
然而,这不编译,我不明白为什么,我对c ++的背景不够深入。 Intellisense(VSc ++ 2013)使用“Ein vererbter Member istnichtzulässig”(“不允许继承的成员”)强调simple_app.cc:17(OnBeforeCommandLineProcessing)。如果我尝试编译它,我会得到“C2509:'OnBeforeCommandLineProcessing':'SimpleApp'nicht deklariert中的Memberfunktion wurde”(“成员函数未在'SimpleApp'中声明”)