mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	- Introduce native/ and osr/ folders for native (non-platform-agnostic) and
    osr (windowless) code respectively.
  - Introduce CefBrowserPlatformDelegate for abstracting platform-specific
    implementations of browser host functionality.
  - Move dialog and menu code to separate manager and platform-specific runner
    implementations exposed via CefBrowserPlatformDelegate.
  - Standardize focus-handling behavior between windowed and windowless
    implementations. CefFocusHandler::OnSetFocus() will now also be called for
    osr focus changes.
- Support multiple simultaneous popups (issue #1289).
		
	
		
			
				
	
	
		
			63 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| // Copyright 2015 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.
 | |
| 
 | |
| #include "libcef/browser/browser_platform_delegate.h"
 | |
| 
 | |
| #if defined(OS_WIN)
 | |
| #include "libcef/browser/native/browser_platform_delegate_native_win.h"
 | |
| #include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
 | |
| #elif defined(OS_MACOSX)
 | |
| #include "libcef/browser/native/browser_platform_delegate_native_mac.h"
 | |
| #include "libcef/browser/osr/browser_platform_delegate_osr_mac.h"
 | |
| #elif defined(OS_LINUX)
 | |
| #include "libcef/browser/native/browser_platform_delegate_native_linux.h"
 | |
| #include "libcef/browser/osr/browser_platform_delegate_osr_linux.h"
 | |
| #else
 | |
| #error A delegate implementation is not available for your platform.
 | |
| #endif
 | |
| 
 | |
| namespace {
 | |
| 
 | |
| scoped_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
 | |
|     const CefWindowInfo& window_info) {
 | |
| #if defined(OS_WIN)
 | |
|   return make_scoped_ptr(new CefBrowserPlatformDelegateNativeWin(window_info));
 | |
| #elif defined(OS_MACOSX)
 | |
|   return make_scoped_ptr(new CefBrowserPlatformDelegateNativeMac(window_info));
 | |
| #elif defined(OS_LINUX)
 | |
|   return make_scoped_ptr(
 | |
|       new CefBrowserPlatformDelegateNativeLinux(window_info));
 | |
| #endif
 | |
| }
 | |
| 
 | |
| scoped_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
 | |
|     scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate) {
 | |
| #if defined(OS_WIN)
 | |
|   return make_scoped_ptr(
 | |
|         new CefBrowserPlatformDelegateOsrWin(native_delegate.Pass()));
 | |
| #elif defined(OS_MACOSX)
 | |
|   return make_scoped_ptr(
 | |
|         new CefBrowserPlatformDelegateOsrMac(native_delegate.Pass()));
 | |
| #elif defined(OS_LINUX)
 | |
|   return make_scoped_ptr(
 | |
|         new CefBrowserPlatformDelegateOsrLinux(native_delegate.Pass()));
 | |
| #endif
 | |
| }
 | |
| 
 | |
| }  // namespace
 | |
| 
 | |
| // static
 | |
| scoped_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
 | |
|     const CefWindowInfo& window_info,
 | |
|     const CefBrowserSettings& settings,
 | |
|     CefRefPtr<CefClient> client) {
 | |
|   scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate =
 | |
|       CreateNativeDelegate(window_info);
 | |
|   if (window_info.windowless_rendering_enabled &&
 | |
|       client->GetRenderHandler().get()) {
 | |
|     return CreateOSRDelegate(native_delegate.Pass());
 | |
|   }
 | |
|   return native_delegate.Pass();
 | |
| }
 |