This source file includes following definitions.
- GetHostDesktopTypeForNativeView
- GetHostDesktopTypeForNativeWindow
- GetActiveDesktop
#include "chrome/browser/ui/host_desktop.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
#include "ash/shell.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/aura/active_desktop_monitor.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
namespace chrome {
HostDesktopType GetHostDesktopTypeForNativeView(gfx::NativeView native_view) {
#if defined(USE_ASH)
#if defined(OS_WIN)
if (!native_view)
return GetActiveDesktop();
#endif
return IsNativeViewInAsh(native_view) ?
HOST_DESKTOP_TYPE_ASH :
HOST_DESKTOP_TYPE_NATIVE;
#else
return HOST_DESKTOP_TYPE_NATIVE;
#endif
}
HostDesktopType GetHostDesktopTypeForNativeWindow(
gfx::NativeWindow native_window) {
#if defined(USE_ASH)
#if defined(OS_WIN)
if (!native_window)
return GetActiveDesktop();
#endif
return IsNativeWindowInAsh(native_window) ?
HOST_DESKTOP_TYPE_ASH :
HOST_DESKTOP_TYPE_NATIVE;
#else
return HOST_DESKTOP_TYPE_NATIVE;
#endif
}
HostDesktopType GetActiveDesktop() {
#if defined(USE_ASH) && !defined(OS_CHROMEOS)
if ((ActiveDesktopMonitor::GetLastActivatedDesktopType() ==
chrome::HOST_DESKTOP_TYPE_ASH) &&
ash::Shell::HasInstance()) {
return HOST_DESKTOP_TYPE_ASH;
}
#endif
return HOST_DESKTOP_TYPE_NATIVE;
}
}