cefclient: Split ClientApp into process-specific types (issue #1500).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2015 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2015-01-31 04:41:36 +00:00
parent 5c28259c31
commit 1ce99c0ed4
37 changed files with 757 additions and 528 deletions

View File

@@ -19,7 +19,9 @@
#include "include/cef_task.h"
#include "include/wrapper/cef_helpers.h"
#include "include/wrapper/cef_closure_task.h"
#include "tests/cefclient/common/client_app.h"
#include "tests/cefclient/browser/client_app_browser.h"
#include "tests/cefclient/common/client_app_other.h"
#include "tests/cefclient/renderer/client_app_renderer.h"
#include "tests/unittests/test_handler.h"
#include "tests/unittests/test_suite.h"
@@ -27,8 +29,6 @@
#include "include/cef_sandbox_win.h"
#endif
using client::ClientApp;
namespace {
// Thread used to run the test suite.
@@ -109,7 +109,26 @@ int main(int argc, char* argv[]) {
windows_sandbox_info = scoped_sandbox.sandbox_info();
#endif
CefRefPtr<CefApp> app(new client::ClientApp);
// Parse command-line arguments.
CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
#if defined(OS_WIN)
command_line->InitFromString(::GetCommandLineW());
#else
command_line->InitFromArgv(argc, argv);
#endif
// Create a ClientApp of the correct type.
CefRefPtr<CefApp> app;
client::ClientApp::ProcessType process_type =
client::ClientApp::GetProcessType(command_line);
if (process_type == client::ClientApp::BrowserProcess) {
app = new client::ClientAppBrowser();
} else if (process_type == client::ClientApp::RendererProcess ||
process_type == client::ClientApp::ZygoteProcess) {
app = new client::ClientAppRenderer();
} else if (process_type == client::ClientApp::OtherProcess) {
app = new client::ClientAppOther();
}
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app, windows_sandbox_info);