summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/host_desktop.h
blob: 9b2dc75d7fcc660c2f0e0531134e7349da291427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2012 The Chromium 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 CHROME_BROWSER_UI_HOST_DESKTOP_H_
#define CHROME_BROWSER_UI_HOST_DESKTOP_H_

#include "ui/gfx/native_widget_types.h"

class Browser;

namespace chrome {

// A value that specifies what desktop environment hosts a particular piece of
// UI.
// Note that HOST_DESKTOP_TYPE_ASH is always used on ChromeOS.
enum HostDesktopType {
  HOST_DESKTOP_TYPE_FIRST = 0,

  // The UI is hosted on the system native desktop.
  HOST_DESKTOP_TYPE_NATIVE = HOST_DESKTOP_TYPE_FIRST,

  // The UI is hosted in the synthetic Ash desktop.
#if defined(OS_CHROMEOS)
  HOST_DESKTOP_TYPE_ASH = HOST_DESKTOP_TYPE_NATIVE,
#else
  HOST_DESKTOP_TYPE_ASH,
#endif

  HOST_DESKTOP_TYPE_COUNT
};

// Used during initialization to override parenting.
class ScopedForceDesktopType {
 public:
  explicit ScopedForceDesktopType(HostDesktopType type);
  ~ScopedForceDesktopType();
 private:
  HostDesktopType previous_type_;
  bool previous_force_;

  DISALLOW_COPY_AND_ASSIGN(ScopedForceDesktopType);
};

HostDesktopType GetHostDesktopTypeForNativeView(gfx::NativeView native_view);
HostDesktopType GetHostDesktopTypeForNativeWindow(
    gfx::NativeWindow native_window);
HostDesktopType GetHostDesktopTypeForBrowser(const Browser* browser);

// Returns the type of host desktop most likely to be in use.  This is the one
// most recently activated by the user.
HostDesktopType GetActiveDesktop();

}  // namespace chrome

#endif  // CHROME_BROWSER_UI_HOST_DESKTOP_H_