mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Simplify and document the relationship between the various context object types. See browser_context.h for a description of the new relationships. - cefclient: Add `request-context-per-browser` command-line flag for testing multiple CefRequestContext instances. - cefclient: Add a CefURLRequest example. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2032 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -5,14 +5,21 @@
|
||||
#include "cefclient/browser/root_window_manager.h"
|
||||
|
||||
#include "include/base/cef_bind.h"
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/wrapper/cef_helpers.h"
|
||||
#include "cefclient/browser/main_context.h"
|
||||
#include "cefclient/browser/test_runner.h"
|
||||
#include "cefclient/common/client_switches.h"
|
||||
|
||||
namespace client {
|
||||
|
||||
RootWindowManager::RootWindowManager(bool terminate_when_all_windows_closed)
|
||||
: terminate_when_all_windows_closed_(terminate_when_all_windows_closed) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
DCHECK(command_line.get());
|
||||
request_context_per_browser_ =
|
||||
command_line->HasSwitch(switches::kRequestContextPerBrowser);
|
||||
}
|
||||
|
||||
RootWindowManager::~RootWindowManager() {
|
||||
@@ -100,6 +107,19 @@ void RootWindowManager::OnRootWindowCreated(
|
||||
root_windows_.insert(root_window);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContext> RootWindowManager::GetRequestContext(
|
||||
RootWindow* root_window) {
|
||||
REQUIRE_MAIN_THREAD();
|
||||
|
||||
if (request_context_per_browser_) {
|
||||
// Create a new request context for each browser.
|
||||
return CefRequestContext::CreateContext(NULL);
|
||||
}
|
||||
|
||||
// All browsers will share the global request context.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RootWindowManager::OnTest(RootWindow* root_window, int test_id) {
|
||||
REQUIRE_MAIN_THREAD();
|
||||
|
||||
|
Reference in New Issue
Block a user