Fix FullScreen crash in Webapp
[platform/framework/web/chromium-efl.git] / ipc / handle_win.h
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IPC_HANDLE_WIN_H_
6 #define IPC_HANDLE_WIN_H_
7
8 #include <windows.h>
9
10 #include <string>
11
12 #include "ipc/ipc_message_support_export.h"
13 #include "ipc/ipc_param_traits.h"
14
15 namespace base {
16 class Pickle;
17 class PickleIterator;
18 }  // namespace base
19
20 namespace IPC {
21
22 // HandleWin is a wrapper around a Windows HANDLE that can be transported
23 // across Chrome IPC channels that support attachment brokering. The HANDLE will
24 // be duplicated into the destination process.
25 //
26 // The ownership semantics for the underlying |handle_| are complex. See
27 // ipc/mach_port_mac.h (the OSX analog of this class) for an extensive
28 // discussion.
29 class IPC_MESSAGE_SUPPORT_EXPORT HandleWin {
30  public:
31   // Default constructor makes an invalid HANDLE.
32   HandleWin();
33   explicit HandleWin(const HANDLE& handle);
34
35   HANDLE get_handle() const { return handle_; }
36   void set_handle(HANDLE handle) { handle_ = handle; }
37
38  private:
39   HANDLE handle_;
40 };
41
42 template <>
43 struct IPC_MESSAGE_SUPPORT_EXPORT ParamTraits<HandleWin> {
44   typedef HandleWin param_type;
45   static void Write(base::Pickle* m, const param_type& p);
46   static bool Read(const base::Pickle* m,
47                    base::PickleIterator* iter,
48                    param_type* p);
49   static void Log(const param_type& p, std::string* l);
50 };
51
52 }  // namespace IPC
53
54 #endif  // IPC_HANDLE_WIN_H_