Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.85 KB | None | 0 0
  1. diff --git a/base/event_types.h b/base/event_types.h
  2. index 9905800d2e8c..1325effe1999 100644
  3. --- a/base/event_types.h
  4. +++ b/base/event_types.h
  5. @@ -22,7 +22,9 @@ class NSEvent;
  6. namespace base {
  7.  
  8. // Cross platform typedefs for native event types.
  9. -#if defined(OS_WIN)
  10. +#if defined(USE_OZONE)
  11. +typedef void* NativeEvent;
  12. +#elif defined(OS_WIN)
  13. typedef MSG NativeEvent;
  14. #elif defined(USE_X11)
  15. typedef XEvent* NativeEvent;
  16. diff --git a/base/file_descriptor_posix.h b/base/file_descriptor_posix.h
  17. index 2a366116a31d..f00e5e283601 100644
  18. --- a/base/file_descriptor_posix.h
  19. +++ b/base/file_descriptor_posix.h
  20. @@ -31,8 +31,9 @@ struct FileDescriptor {
  21. FileDescriptor(int ifd, bool iauto_close) : fd(ifd), auto_close(iauto_close) {
  22. }
  23.  
  24. - FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true) {}
  25. - explicit FileDescriptor(ScopedFD fd) : fd(fd.release()), auto_close(true) {}
  26. + // FileDescriptor(File file) : fd(file.TakePlatformFile()), auto_close(true)
  27. + // {} explicit FileDescriptor(ScopedFD fd) : fd(fd.release()),
  28. + // auto_close(true) {}
  29.  
  30. bool operator==(const FileDescriptor& other) const {
  31. return (fd == other.fd && auto_close == other.auto_close);
  32. diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
  33. index 252cd04c63ea..b9dd177bd0fe 100644
  34. --- a/base/message_loop/message_loop.cc
  35. +++ b/base/message_loop/message_loop.cc
  36. @@ -533,7 +533,7 @@ void MessageLoopForUI::Attach() {
  37. }
  38. #endif
  39.  
  40. -#if (defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
  41. +#if (!defined(OS_WIN) && defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
  42. (defined(USE_X11) && !defined(USE_GLIB))
  43. bool MessageLoopForUI::WatchFileDescriptor(
  44. int fd,
  45. diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
  46. index 2f4f24fdca5c..0c5f48ed218f 100644
  47. --- a/base/message_loop/message_loop.h
  48. +++ b/base/message_loop/message_loop.h
  49. @@ -458,7 +458,7 @@ class BASE_EXPORT MessageLoopForUI : public MessageLoop {
  50. void Abort();
  51. #endif
  52.  
  53. -#if (defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
  54. +#if (!defined(OS_WIN) && defined(USE_OZONE) && !defined(OS_FUCHSIA)) || \
  55. (defined(USE_X11) && !defined(USE_GLIB))
  56. // Please see MessagePumpLibevent for definition.
  57. bool WatchFileDescriptor(
  58. diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
  59. index 2df1c23c98da..d31170442078 100644
  60. --- a/ipc/ipc_message_utils.h
  61. +++ b/ipc/ipc_message_utils.h
  62. @@ -98,22 +98,23 @@ struct CheckedTuple {
  63. // 3. Any template referencing types above (e.g. std::vector<size_t>)
  64. template <class P>
  65. static inline void WriteParam(base::Pickle* m, const P& p) {
  66. - typedef typename SimilarTypeTraits<P>::Type Type;
  67. - ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
  68. + // typedef typename SimilarTypeTraits<P>::Type Type;
  69. + // ParamTraits<Type>::Write(m, static_cast<const Type& >(p));
  70. }
  71.  
  72. template <class P>
  73. static inline bool WARN_UNUSED_RESULT ReadParam(const base::Pickle* m,
  74. base::PickleIterator* iter,
  75. P* p) {
  76. - typedef typename SimilarTypeTraits<P>::Type Type;
  77. - return ParamTraits<Type>::Read(m, iter, reinterpret_cast<Type* >(p));
  78. + // typedef typename SimilarTypeTraits<P>::Type Type;
  79. + // return ParamTraits<Type>::Read(m, iter, reinterpret_cast<Type* >(p));
  80. + return false;
  81. }
  82.  
  83. template <class P>
  84. static inline void LogParam(const P& p, std::string* l) {
  85. - typedef typename SimilarTypeTraits<P>::Type Type;
  86. - ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
  87. + // typedef typename SimilarTypeTraits<P>::Type Type;
  88. + // ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
  89. }
  90.  
  91. // Primitive ParamTraits -------------------------------------------------------
  92. diff --git a/ipc/ipc_param_traits.h b/ipc/ipc_param_traits.h
  93. index 9aaeb5e506bb..a3aca6fe8678 100644
  94. --- a/ipc/ipc_param_traits.h
  95. +++ b/ipc/ipc_param_traits.h
  96. @@ -19,9 +19,9 @@ struct AlwaysFalse {
  97. } // namespace internal
  98.  
  99. template <class P> struct ParamTraits {
  100. - static_assert(internal::AlwaysFalse<P>::value,
  101. - "Cannot find the IPC::ParamTraits specialization. Did you "
  102. - "forget to include the corresponding header file?");
  103. + // static_assert(internal::AlwaysFalse<P>::value,
  104. + // "Cannot find the IPC::ParamTraits specialization. Did you "
  105. + // "forget to include the corresponding header file?");
  106. };
  107.  
  108. template <class P>
  109. diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
  110. index 9a5f703b7cf8..65bb840cca1f 100644
  111. --- a/ui/base/BUILD.gn
  112. +++ b/ui/base/BUILD.gn
  113. @@ -586,13 +586,13 @@ component("base") {
  114.  
  115. if (use_ozone) {
  116. sources += [
  117. - "cursor/cursor_loader_ozone.cc",
  118. - "cursor/cursor_loader_ozone.h",
  119. - "cursor/cursor_ozone.cc",
  120. - "cursor/ozone/bitmap_cursor_factory_ozone.cc",
  121. - "cursor/ozone/bitmap_cursor_factory_ozone.h",
  122. - "cursor/ozone/cursor_data_factory_ozone.cc",
  123. - "cursor/ozone/cursor_data_factory_ozone.h",
  124. + #"cursor/cursor_loader_ozone.cc",
  125. + #"cursor/cursor_loader_ozone.h",
  126. + #"cursor/cursor_ozone.cc",
  127. + #"cursor/ozone/bitmap_cursor_factory_ozone.cc",
  128. + #"cursor/ozone/bitmap_cursor_factory_ozone.h",
  129. + #"cursor/ozone/cursor_data_factory_ozone.cc",
  130. + #"cursor/ozone/cursor_data_factory_ozone.h",
  131. ]
  132.  
  133. deps += [
  134. @@ -601,7 +601,7 @@ component("base") {
  135. ]
  136.  
  137. if (!is_fuchsia) {
  138. - deps += [ "//ui/events/ozone:events_ozone_evdev" ]
  139. + #deps += [ "//ui/events/ozone:events_ozone_evdev" ]
  140. }
  141. }
  142.  
  143. diff --git a/ui/base/cursor/cursor.h b/ui/base/cursor/cursor.h
  144. index 716e7cf72b66..45182e928779 100644
  145. --- a/ui/base/cursor/cursor.h
  146. +++ b/ui/base/cursor/cursor.h
  147. @@ -17,7 +17,9 @@ typedef HICON HCURSOR;
  148.  
  149. namespace ui {
  150.  
  151. -#if defined(OS_WIN)
  152. +#if defined(USE_OZONE)
  153. +typedef void* PlatformCursor;
  154. +#elif defined(OS_WIN)
  155. typedef ::HCURSOR PlatformCursor;
  156. #elif defined(USE_X11)
  157. typedef unsigned long PlatformCursor;
  158. diff --git a/ui/base/cursor/cursors_aura.cc b/ui/base/cursor/cursors_aura.cc
  159. index fbefd76087e9..da8d85c5ebb2 100644
  160. --- a/ui/base/cursor/cursors_aura.cc
  161. +++ b/ui/base/cursor/cursors_aura.cc
  162. @@ -290,14 +290,14 @@ bool GetCursorBitmap(const Cursor& cursor,
  163. SkBitmap* bitmap,
  164. gfx::Point* point) {
  165. DCHECK(bitmap && point);
  166. -#if defined(OS_WIN)
  167. - Cursor cursor_copy = cursor;
  168. - ui::CursorLoaderWin cursor_loader;
  169. - cursor_loader.SetPlatformCursor(&cursor_copy);
  170. - const std::unique_ptr<SkBitmap> cursor_bitmap(
  171. - IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform()));
  172. - *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform());
  173. -#else
  174. + // #if defined(OS_WIN)
  175. + // Cursor cursor_copy = cursor;
  176. + // ui::CursorLoaderWin cursor_loader;
  177. + // cursor_loader.SetPlatformCursor(&cursor_copy);
  178. + // const std::unique_ptr<SkBitmap> cursor_bitmap(
  179. + // IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform()));
  180. + // *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform());
  181. + // #else
  182. int resource_id;
  183. if (!GetCursorDataFor(ui::CursorSize::kNormal, cursor.native_type(),
  184. cursor.device_scale_factor(), &resource_id, point)) {
  185. @@ -306,7 +306,7 @@ bool GetCursorBitmap(const Cursor& cursor,
  186.  
  187. const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance().
  188. GetImageSkiaNamed(resource_id)->bitmap();
  189. -#endif
  190. + // #endif
  191. if (!cursor_bitmap)
  192. return false;
  193. *bitmap = *cursor_bitmap;
  194. diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc
  195. index fc430495abfb..948ac4c977bc 100644
  196. --- a/ui/base/ime/input_method_win.cc
  197. +++ b/ui/base/ime/input_method_win.cc
  198. @@ -25,11 +25,11 @@
  199. namespace ui {
  200. namespace {
  201.  
  202. -ui::EventDispatchDetails DispatcherDestroyedDetails() {
  203. - ui::EventDispatchDetails dispatcher_details;
  204. - dispatcher_details.dispatcher_destroyed = true;
  205. - return dispatcher_details;
  206. -}
  207. +// ui::EventDispatchDetails DispatcherDestroyedDetails() {
  208. +// ui::EventDispatchDetails dispatcher_details;
  209. +// dispatcher_details.dispatcher_destroyed = true;
  210. +// return dispatcher_details;
  211. +// }
  212.  
  213. } // namespace
  214.  
  215. @@ -57,40 +57,40 @@ bool InputMethodWin::OnUntranslatedIMEMessage(
  216. LRESULT original_result = 0;
  217. BOOL handled = FALSE;
  218.  
  219. - switch (event.message) {
  220. - case WM_IME_SETCONTEXT:
  221. - original_result = OnImeSetContext(
  222. - event.hwnd, event.message, event.wParam, event.lParam, &handled);
  223. - break;
  224. - case WM_IME_STARTCOMPOSITION:
  225. - original_result = OnImeStartComposition(
  226. - event.hwnd, event.message, event.wParam, event.lParam, &handled);
  227. - break;
  228. - case WM_IME_COMPOSITION:
  229. - original_result = OnImeComposition(
  230. - event.hwnd, event.message, event.wParam, event.lParam, &handled);
  231. - break;
  232. - case WM_IME_ENDCOMPOSITION:
  233. - original_result = OnImeEndComposition(
  234. - event.hwnd, event.message, event.wParam, event.lParam, &handled);
  235. - break;
  236. - case WM_IME_REQUEST:
  237. - original_result = OnImeRequest(
  238. - event.message, event.wParam, event.lParam, &handled);
  239. - break;
  240. - case WM_CHAR:
  241. - case WM_SYSCHAR:
  242. - original_result = OnChar(event.hwnd, event.message, event.wParam,
  243. - event.lParam, event, &handled);
  244. - break;
  245. - case WM_IME_NOTIFY:
  246. - original_result = OnImeNotify(
  247. - event.message, event.wParam, event.lParam, &handled);
  248. - break;
  249. - default:
  250. - NOTREACHED() << "Unknown IME message:" << event.message;
  251. - break;
  252. - }
  253. + // switch (event.message) {
  254. + // case WM_IME_SETCONTEXT:
  255. + // original_result = OnImeSetContext(
  256. + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
  257. + // break;
  258. + // case WM_IME_STARTCOMPOSITION:
  259. + // original_result = OnImeStartComposition(
  260. + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
  261. + // break;
  262. + // case WM_IME_COMPOSITION:
  263. + // original_result = OnImeComposition(
  264. + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
  265. + // break;
  266. + // case WM_IME_ENDCOMPOSITION:
  267. + // original_result = OnImeEndComposition(
  268. + // event.hwnd, event.message, event.wParam, event.lParam, &handled);
  269. + // break;
  270. + // case WM_IME_REQUEST:
  271. + // original_result = OnImeRequest(
  272. + // event.message, event.wParam, event.lParam, &handled);
  273. + // break;
  274. + // case WM_CHAR:
  275. + // case WM_SYSCHAR:
  276. + // original_result = OnChar(event.hwnd, event.message, event.wParam,
  277. + // event.lParam, event, &handled);
  278. + // break;
  279. + // case WM_IME_NOTIFY:
  280. + // original_result = OnImeNotify(
  281. + // event.message, event.wParam, event.lParam, &handled);
  282. + // break;
  283. + // default:
  284. + // NOTREACHED() << "Unknown IME message:" << event.message;
  285. + // break;
  286. + // }
  287. if (result)
  288. *result = original_result;
  289. return !!handled;
  290. @@ -101,18 +101,18 @@ ui::EventDispatchDetails InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) {
  291. return DispatchFabricatedKeyEvent(event);
  292.  
  293. const base::NativeEvent& native_key_event = event->native_event();
  294. - BOOL handled = FALSE;
  295. - if (native_key_event.message == WM_CHAR) {
  296. - auto ref = weak_ptr_factory_.GetWeakPtr();
  297. - OnChar(native_key_event.hwnd, native_key_event.message,
  298. - native_key_event.wParam, native_key_event.lParam, native_key_event,
  299. - &handled);
  300. - if (!ref)
  301. - return DispatcherDestroyedDetails();
  302. - if (handled)
  303. - event->StopPropagation();
  304. - return ui::EventDispatchDetails();
  305. - }
  306. + // BOOL handled = FALSE;
  307. + // if (native_key_event.message == WM_CHAR) {
  308. + // auto ref = weak_ptr_factory_.GetWeakPtr();
  309. + // OnChar(native_key_event.hwnd, native_key_event.message,
  310. + // native_key_event.wParam, native_key_event.lParam,
  311. + // native_key_event, &handled);
  312. + // if (!ref)
  313. + // return DispatcherDestroyedDetails();
  314. + // if (handled)
  315. + // event->StopPropagation();
  316. + // return ui::EventDispatchDetails();
  317. + // }
  318.  
  319. std::vector<MSG> char_msgs;
  320. // Combines the WM_KEY* and WM_CHAR messages in the event processing flow
  321. @@ -125,17 +125,17 @@ ui::EventDispatchDetails InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) {
  322. // the WM_KEY*.
  323. // Chrome never handles dead chars so it is safe to remove/ignore
  324. // WM_*DEADCHAR messages.
  325. - MSG msg;
  326. - while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_DEADCHAR,
  327. - PM_REMOVE)) {
  328. - if (msg.message == WM_CHAR)
  329. - char_msgs.push_back(msg);
  330. - }
  331. - while (::PeekMessage(&msg, native_key_event.hwnd, WM_SYSCHAR,
  332. - WM_SYSDEADCHAR, PM_REMOVE)) {
  333. - if (msg.message == WM_SYSCHAR)
  334. - char_msgs.push_back(msg);
  335. - }
  336. + // MSG msg;
  337. + // while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_DEADCHAR,
  338. + // PM_REMOVE)) {
  339. + // if (msg.message == WM_CHAR)
  340. + // char_msgs.push_back(msg);
  341. + // }
  342. + // while (::PeekMessage(&msg, native_key_event.hwnd, WM_SYSCHAR,
  343. + // WM_SYSDEADCHAR, PM_REMOVE)) {
  344. + // if (msg.message == WM_SYSCHAR)
  345. + // char_msgs.push_back(msg);
  346. + // }
  347.  
  348. // Handles ctrl-shift key to change text direction and layout alignment.
  349. if (ui::IMM32Manager::IsRTLKeyboardLayoutInstalled() &&
  350. @@ -202,13 +202,13 @@ ui::EventDispatchDetails InputMethodWin::ProcessUnhandledKeyEvent(
  351. return details;
  352. }
  353.  
  354. - BOOL handled;
  355. - for (const auto& msg : (*char_msgs)) {
  356. - auto ref = weak_ptr_factory_.GetWeakPtr();
  357. - OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, msg, &handled);
  358. - if (!ref)
  359. - return DispatcherDestroyedDetails();
  360. - }
  361. + // BOOL handled;
  362. + // for (const auto& msg : (*char_msgs)) {
  363. + // auto ref = weak_ptr_factory_.GetWeakPtr();
  364. + // OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, msg, &handled);
  365. + // if (!ref)
  366. + // return DispatcherDestroyedDetails();
  367. + // }
  368. return details;
  369. }
  370.  
  371. diff --git a/ui/base/ime/input_method_win_tsf.cc b/ui/base/ime/input_method_win_tsf.cc
  372. index 427ac8920bb3..ffb2aa85b8d6 100644
  373. --- a/ui/base/ime/input_method_win_tsf.cc
  374. +++ b/ui/base/ime/input_method_win_tsf.cc
  375. @@ -59,25 +59,29 @@ bool InputMethodWinTSF::OnUntranslatedIMEMessage(
  376. LRESULT original_result = 0;
  377. BOOL handled = FALSE;
  378. // Even when TSF is enabled, following IMM32/Win32 messages must be handled.
  379. - switch (event.message) {
  380. - case WM_IME_REQUEST:
  381. - // Some TSF-native TIPs (Text Input Processors) such as ATOK and Mozc
  382. - // still rely on WM_IME_REQUEST message to implement reverse conversion.
  383. - original_result =
  384. - OnImeRequest(event.message, event.wParam, event.lParam, &handled);
  385. - break;
  386. - case WM_CHAR:
  387. - case WM_SYSCHAR:
  388. - // ui::InputMethod interface is responsible for handling Win32 character
  389. - // messages. For instance, we will be here in the following cases.
  390. - // - TIP is not activated. (e.g, the current language profile is English)
  391. - // - TIP does not handle and WM_KEYDOWN and WM_KEYDOWN is translated into
  392. - // WM_CHAR by TranslateMessage API. (e.g, TIP is turned off)
  393. - // - Another application sends WM_CHAR through SendMessage API.
  394. - original_result = OnChar(event.hwnd, event.message, event.wParam,
  395. - event.lParam, event, &handled);
  396. - break;
  397. - }
  398. + // switch (event.message) {
  399. + // case WM_IME_REQUEST:
  400. + // // Some TSF-native TIPs (Text Input Processors) such as ATOK and Mozc
  401. + // // still rely on WM_IME_REQUEST message to implement reverse
  402. + // conversion. original_result =
  403. + // OnImeRequest(event.message, event.wParam, event.lParam, &handled);
  404. + // break;
  405. + // case WM_CHAR:
  406. + // case WM_SYSCHAR:
  407. + // // ui::InputMethod interface is responsible for handling Win32
  408. + // character
  409. + // // messages. For instance, we will be here in the following cases.
  410. + // // - TIP is not activated. (e.g, the current language profile is
  411. + // English)
  412. + // // - TIP does not handle and WM_KEYDOWN and WM_KEYDOWN is translated
  413. + // into
  414. + // // WM_CHAR by TranslateMessage API. (e.g, TIP is turned off)
  415. + // // - Another application sends WM_CHAR through SendMessage API.
  416. + // original_result = OnChar(event.hwnd, event.message, event.wParam,
  417. + // event.lParam, event, &handled);
  418. + // break;
  419. + // }
  420. +
  421. if (result)
  422. *result = original_result;
  423. return !!handled;
  424. diff --git a/ui/events/BUILD.gn b/ui/events/BUILD.gn
  425. index 31b5ea9f74e0..5872ed95daa1 100644
  426. --- a/ui/events/BUILD.gn
  427. +++ b/ui/events/BUILD.gn
  428. @@ -148,8 +148,9 @@ component("events") {
  429. "scoped_target_handler.h",
  430. "system_input_injector.cc",
  431. "system_input_injector.h",
  432. - "win/events_win.cc",
  433. - "win/keyboard_hook_win.cc",
  434. +
  435. + #"win/events_win.cc",
  436. + #"win/keyboard_hook_win.cc",
  437. "win/system_event_state_lookup.cc",
  438. "win/system_event_state_lookup.h",
  439. "x/keyboard_hook_posix.cc",
  440. @@ -485,7 +486,8 @@ if (!is_ios) {
  441.  
  442. deps += [
  443. "//ui/events/ozone:events_ozone",
  444. - "//ui/events/ozone:events_ozone_evdev",
  445. +
  446. + #"//ui/events/ozone:events_ozone_evdev",
  447. "//ui/events/ozone:events_ozone_layout",
  448. ]
  449. }
  450. diff --git a/ui/events/event.cc b/ui/events/event.cc
  451. index 68daf98868ed..6a70c334ce6d 100644
  452. --- a/ui/events/event.cc
  453. +++ b/ui/events/event.cc
  454. @@ -1135,7 +1135,7 @@ bool KeyEvent::IsRepeated(const KeyEvent& event) {
  455. if (event.HasNativeEvent()) {
  456. // Bit 30 of lParam represents the "previous key state". If set, the key
  457. // was already down, therefore this is an auto-repeat.
  458. - is_repeat = (event.native_event().lParam & 0x40000000) != 0;
  459. + // is_repeat = (event.native_event().lParam & 0x40000000) != 0;
  460. } else
  461. #endif
  462. {
  463. @@ -1181,8 +1181,8 @@ KeyEvent::KeyEvent(const base::NativeEvent& native_event, int event_flags)
  464. #if defined(OS_WIN)
  465. // Only Windows has native character events.
  466. if (is_char_) {
  467. - key_ = DomKey::FromCharacter(native_event.wParam);
  468. - set_flags(PlatformKeyMap::ReplaceControlAndAltWithAltGraph(flags()));
  469. + // key_ = DomKey::FromCharacter(native_event.wParam);
  470. + // set_flags(PlatformKeyMap::ReplaceControlAndAltWithAltGraph(flags()));
  471. } else {
  472. int adjusted_flags = flags();
  473. key_ = PlatformKeyMap::DomKeyFromKeyboardCode(key_code(), &adjusted_flags);
  474. diff --git a/ui/events/ozone/device/device_manager_manual.cc b/ui/events/ozone/device/device_manager_manual.cc
  475. index 8010870abd4a..0504b5ea1218 100644
  476. --- a/ui/events/ozone/device/device_manager_manual.cc
  477. +++ b/ui/events/ozone/device/device_manager_manual.cc
  478. @@ -17,11 +17,11 @@ namespace ui {
  479.  
  480. namespace {
  481.  
  482. -const char kDevInput[] = "/dev/input";
  483. +const base::FilePath::CharType kDevInput[] = FILE_PATH_LITERAL("/dev/input");
  484.  
  485. void ScanDevicesOnWorkerThread(std::vector<base::FilePath>* result) {
  486. - base::FileEnumerator file_enum(base::FilePath(FILE_PATH_LITERAL(kDevInput)),
  487. - false, base::FileEnumerator::FILES,
  488. + base::FileEnumerator file_enum(base::FilePath(kDevInput), false,
  489. + base::FileEnumerator::FILES,
  490. FILE_PATH_LITERAL("event*[0-9]"));
  491. for (base::FilePath path = file_enum.Next(); !path.empty();
  492. path = file_enum.Next()) {
  493. @@ -58,7 +58,7 @@ void DeviceManagerManual::RemoveObserver(DeviceEventObserver* observer) {
  494. }
  495.  
  496. void DeviceManagerManual::StartWatching() {
  497. - if (!watcher_.Watch(base::FilePath(FILE_PATH_LITERAL(kDevInput)), false,
  498. + if (!watcher_.Watch(base::FilePath(kDevInput), false,
  499. base::Bind(&DeviceManagerManual::OnWatcherEvent,
  500. weak_ptr_factory_.GetWeakPtr()))) {
  501. LOG(ERROR) << "Failed to start FilePathWatcher";
  502. diff --git a/ui/events/test/event_generator.cc b/ui/events/test/event_generator.cc
  503. index 5f97117f198e..56e985629399 100644
  504. --- a/ui/events/test/event_generator.cc
  505. +++ b/ui/events/test/event_generator.cc
  506. @@ -646,7 +646,7 @@ void EventGenerator::Init(gfx::NativeWindow root_window,
  507. void EventGenerator::DispatchKeyEvent(bool is_press,
  508. ui::KeyboardCode key_code,
  509. int flags) {
  510. -#if defined(OS_WIN)
  511. +#if defined(OS_WIN) && false
  512. UINT key_press = WM_KEYDOWN;
  513. uint16_t character = ui::DomCodeToUsLayoutCharacter(
  514. ui::UsLayoutKeyboardCodeToDomCode(key_code), flags);
  515. diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
  516. index b1bd611c72a6..8a031e0ad719 100644
  517. --- a/ui/gl/BUILD.gn
  518. +++ b/ui/gl/BUILD.gn
  519. @@ -198,7 +198,7 @@ component("gl") {
  520. "gl_surface_egl.h",
  521. ]
  522.  
  523. - if (is_linux) {
  524. + if (is_linux || use_ozone) {
  525. sources += [
  526. "gl_image_native_pixmap.cc",
  527. "gl_image_native_pixmap.h",
  528. @@ -224,7 +224,7 @@ component("gl") {
  529. ]
  530. }
  531. }
  532. - if (is_android || is_linux || is_fuchsia) {
  533. + if (is_android || is_linux || is_fuchsia || is_win) {
  534. sources += [
  535. "gl_implementation_osmesa.cc",
  536. "gl_implementation_osmesa.h",
  537. diff --git a/ui/gl/gl_image_native_pixmap.cc b/ui/gl/gl_image_native_pixmap.cc
  538. index f86defd7c8df..9ee4dca0f399 100644
  539. --- a/ui/gl/gl_image_native_pixmap.cc
  540. +++ b/ui/gl/gl_image_native_pixmap.cc
  541. @@ -6,6 +6,7 @@
  542.  
  543. #include <vector>
  544.  
  545. +#include "build/build_config.h"
  546. #include "ui/gfx/buffer_format_util.h"
  547. #include "ui/gl/egl_util.h"
  548. #include "ui/gl/gl_context.h"
  549. @@ -300,7 +301,7 @@ gfx::NativePixmapHandle GLImageNativePixmap::ExportHandle() {
  550. }
  551.  
  552. gfx::NativePixmapHandle handle;
  553. -
  554. +#if defined(OS_LINUX)
  555. for (int i = 0; i < num_planes; ++i) {
  556. // Sanity check. In principle all the fds are meant to be valid when
  557. // eglExportDMABUFImageMESA succeeds.
  558. @@ -320,7 +321,7 @@ gfx::NativePixmapHandle GLImageNativePixmap::ExportHandle() {
  559. handle.planes.emplace_back(strides[i], offsets[i], 0 /* size opaque */,
  560. modifiers);
  561. }
  562. -
  563. +#endif
  564. return handle;
  565. }
  566.  
  567. diff --git a/ui/gl/gl_implementation_osmesa.cc b/ui/gl/gl_implementation_osmesa.cc
  568. index 14fa64897a22..8b6c6c39adfb 100644
  569. --- a/ui/gl/gl_implementation_osmesa.cc
  570. +++ b/ui/gl/gl_implementation_osmesa.cc
  571. @@ -33,7 +33,13 @@ bool InitializeStaticGLBindingsOSMesaGL() {
  572. }
  573. #endif // !defined(OS_FUCHSIA)
  574.  
  575. - base::FilePath library_path = module_path.Append("libosmesa.so");
  576. +#if defined(OS_WIN)
  577. + base::FilePath library_path =
  578. + module_path.Append(FILE_PATH_LITERAL("osmesa.dll"));
  579. +#else
  580. + base::FilePath library_path =
  581. + module_path.Append(FILE_PATH_LITERAL("libosmesa.so"));
  582. +#endif
  583. base::NativeLibrary library = LoadLibraryAndPrintError(library_path);
  584. if (!library)
  585. return false;
  586. diff --git a/ui/gl/init/BUILD.gn b/ui/gl/init/BUILD.gn
  587. index d55a06bf4812..61ffac7112fb 100644
  588. --- a/ui/gl/init/BUILD.gn
  589. +++ b/ui/gl/init/BUILD.gn
  590. @@ -33,7 +33,15 @@ jumbo_component("init") {
  591. "//ui/gl",
  592. ]
  593.  
  594. - if (is_android) {
  595. + if (use_ozone) {
  596. + sources += [
  597. + "gl_factory_ozone.cc",
  598. + "gl_initializer_ozone.cc",
  599. + "ozone_util.h",
  600. + ]
  601. +
  602. + deps += [ "//ui/ozone" ]
  603. + } else if (is_android) {
  604. sources += [
  605. "gl_factory_android.cc",
  606. "gl_initializer_android.cc",
  607. @@ -60,13 +68,5 @@ jumbo_component("init") {
  608. ]
  609.  
  610. deps += [ "//ui/gfx/x" ]
  611. - } else if (use_ozone) {
  612. - sources += [
  613. - "gl_factory_ozone.cc",
  614. - "gl_initializer_ozone.cc",
  615. - "ozone_util.h",
  616. - ]
  617. -
  618. - deps += [ "//ui/ozone" ]
  619. }
  620. }
  621. diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn
  622. index 2154dd02c676..fe264573fd45 100644
  623. --- a/ui/ozone/BUILD.gn
  624. +++ b/ui/ozone/BUILD.gn
  625. @@ -21,6 +21,11 @@ ozone_platform_deps = ozone_external_platform_deps
  626. # Extra dependencies to pull into ozone_unittests for built platforms.
  627. ozone_platform_test_deps = ozone_external_platform_test_deps
  628.  
  629. +if (ozone_platform_windzone) {
  630. + ozone_platforms += [ "windzone" ]
  631. + ozone_platform_deps += [ "platform/windzone" ]
  632. +}
  633. +
  634. if (ozone_platform_headless) {
  635. ozone_platforms += [ "headless" ]
  636. ozone_platform_deps += [ "platform/headless" ]
  637. diff --git a/ui/ozone/DEPS b/ui/ozone/DEPS
  638. index bcaff46ed217..ef50f3ccbed4 100644
  639. --- a/ui/ozone/DEPS
  640. +++ b/ui/ozone/DEPS
  641. @@ -1,6 +1,7 @@
  642. include_rules = [
  643. "+services/service_manager/public/cpp",
  644. "+skia/ext",
  645. + "+third_party/angle",
  646. "+third_party/khronos",
  647. "+third_party/skia",
  648. "+ui/display",
  649. diff --git a/ui/ozone/common/egl_util.cc b/ui/ozone/common/egl_util.cc
  650. index 9a40d1db0017..86636c3f94b6 100644
  651. --- a/ui/ozone/common/egl_util.cc
  652. +++ b/ui/ozone/common/egl_util.cc
  653. @@ -14,12 +14,16 @@
  654. namespace ui {
  655. namespace {
  656.  
  657. -const char kDefaultEglSoname[] = "libEGL.so.1";
  658. -const char kDefaultGlesSoname[] = "libGLESv2.so.2";
  659. +const base::FilePath::CharType kDefaultEglSoname[] =
  660. + FILE_PATH_LITERAL("libEGL.so.1");
  661. +const base::FilePath::CharType kDefaultGlesSoname[] =
  662. + FILE_PATH_LITERAL("libGLESv2.so.2");
  663.  
  664. #if BUILDFLAG(ENABLE_SWIFTSHADER)
  665. -const char kGLESv2SwiftShaderLibraryName[] = "libGLESv2.so";
  666. -const char kEGLSwiftShaderLibraryName[] = "libEGL.so";
  667. +const base::FilePath::CharType kGLESv2SwiftShaderLibraryName[] =
  668. + FILE_PATH_LITERAL("libGLESv2.so");
  669. +const base::FilePath::CharType kEGLSwiftShaderLibraryName[] =
  670. + FILE_PATH_LITERAL("libEGL.so");
  671. #endif
  672.  
  673. bool LoadEGLGLES2Bindings(const base::FilePath& egl_library_path,
  674. @@ -69,7 +73,7 @@ bool LoadDefaultEGLGLES2Bindings(gl::GLImplementation implementation) {
  675. base::FilePath module_path;
  676. if (!PathService::Get(base::DIR_MODULE, &module_path))
  677. return false;
  678. - module_path = module_path.Append("swiftshader/");
  679. + module_path = module_path.Append(FILE_PATH_LITERAL("swiftshader/"));
  680.  
  681. glesv2_path = module_path.Append(kGLESv2SwiftShaderLibraryName);
  682. egl_path = module_path.Append(kEGLSwiftShaderLibraryName);
  683. diff --git a/ui/ozone/common/gl_ozone_egl.h b/ui/ozone/common/gl_ozone_egl.h
  684. index 7e43d71fd4f0..44b3687a667b 100644
  685. --- a/ui/ozone/common/gl_ozone_egl.h
  686. +++ b/ui/ozone/common/gl_ozone_egl.h
  687. @@ -7,6 +7,7 @@
  688.  
  689. #include "base/callback.h"
  690. #include "base/macros.h"
  691. +#include "third_party/angle/include/EGL/eglplatform.h"
  692. #include "ui/gl/gl_implementation.h"
  693. #include "ui/ozone/public/gl_ozone.h"
  694.  
  695. @@ -42,7 +43,7 @@ class GLOzoneEGL : public GLOzone {
  696. protected:
  697. // Returns native platform display handle. This is used to obtain the EGL
  698. // display connection for the native display.
  699. - virtual intptr_t GetNativeDisplay() = 0;
  700. + virtual EGLNativeDisplayType GetNativeDisplay() = 0;
  701.  
  702. // Sets up GL bindings for the native surface.
  703. virtual bool LoadGLES2Bindings(gl::GLImplementation implementation) = 0;
  704. diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc
  705. index ed283ba64945..4e38c870fb4b 100644
  706. --- a/ui/ozone/demo/ozone_demo.cc
  707. +++ b/ui/ozone/demo/ozone_demo.cc
  708. @@ -37,6 +37,10 @@
  709. #include "ui/platform_window/platform_window.h"
  710. #include "ui/platform_window/platform_window_delegate.h"
  711.  
  712. +#if !defined(OS_WIN)
  713. +#error "OS IS NOT WINDOWS"
  714. +#endif
  715. +
  716. const int kTestWindowWidth = 800;
  717. const int kTestWindowHeight = 600;
  718.  
  719. @@ -80,10 +84,10 @@ class RendererFactory {
  720. DISALLOW_COPY_AND_ASSIGN(RendererFactory);
  721. };
  722.  
  723. -class WindowManager : public display::NativeDisplayObserver {
  724. +class WindowManager {
  725. public:
  726. explicit WindowManager(const base::Closure& quit_closure);
  727. - ~WindowManager() override;
  728. + ~WindowManager();
  729.  
  730. void Quit();
  731.  
  732. @@ -96,8 +100,8 @@ class WindowManager : public display::NativeDisplayObserver {
  733. void OnDisplayConfigured(const gfx::Rect& bounds, bool success);
  734.  
  735. // display::NativeDisplayDelegate:
  736. - void OnConfigurationChanged() override;
  737. - void OnDisplaySnapshotsInvalidated() override;
  738. + void OnConfigurationChanged();
  739. + void OnDisplaySnapshotsInvalidated();
  740.  
  741. std::unique_ptr<display::NativeDisplayDelegate> delegate_;
  742. base::Closure quit_closure_;
  743. @@ -254,7 +258,7 @@ WindowManager::WindowManager(const base::Closure& quit_closure)
  744. LOG(FATAL) << "Failed to initialize renderer factory";
  745.  
  746. if (delegate_) {
  747. - delegate_->AddObserver(this);
  748. + // delegate_->AddObserver(this);
  749. delegate_->Initialize();
  750. OnConfigurationChanged();
  751. } else {
  752. @@ -273,8 +277,8 @@ WindowManager::WindowManager(const base::Closure& quit_closure)
  753. }
  754.  
  755. WindowManager::~WindowManager() {
  756. - if (delegate_)
  757. - delegate_->RemoveObserver(this);
  758. + // if (delegate_)
  759. + // delegate_->RemoveObserver(this);
  760. }
  761.  
  762. void WindowManager::Quit() {
  763. @@ -341,6 +345,7 @@ int main(int argc, char** argv) {
  764.  
  765. // Initialize logging so we can enable VLOG messages.
  766. logging::LoggingSettings settings;
  767. + settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
  768. logging::InitLogging(settings);
  769.  
  770. if (base::CommandLine::ForCurrentProcess()->HasSwitch(kHelp)) {
  771. diff --git a/ui/ozone/demo/skia_renderer.cc b/ui/ozone/demo/skia_renderer.cc
  772. index 71154c08925b..73a168343530 100644
  773. --- a/ui/ozone/demo/skia_renderer.cc
  774. +++ b/ui/ozone/demo/skia_renderer.cc
  775. @@ -50,6 +50,7 @@ SkiaRenderer::~SkiaRenderer() {
  776. bool SkiaRenderer::Initialize() {
  777. gl_context_ = gl::init::CreateGLContext(nullptr, gl_surface_.get(),
  778. gl::GLContextAttribs());
  779. + printf("skia\n");
  780. if (!gl_context_.get()) {
  781. LOG(FATAL) << "Failed to create GL context";
  782. return false;
  783. diff --git a/ui/ozone/ozone.gni b/ui/ozone/ozone.gni
  784. index 8e8105136094..ead072a489f1 100644
  785. --- a/ui/ozone/ozone.gni
  786. +++ b/ui/ozone/ozone.gni
  787. @@ -59,11 +59,14 @@ declare_args() {
  788. ozone_platform = "x11"
  789. ozone_platform_wayland = true
  790. ozone_platform_x11 = true
  791. + } else if (is_win) {
  792. + ozone_platform = "windzone"
  793. + ozone_platform_windzone = true
  794. }
  795. }
  796. }
  797.  
  798. assert(use_ozone || !(ozone_platform_cast || ozone_platform_gbm ||
  799. ozone_platform_headless || ozone_platform_x11 ||
  800. - ozone_platform_wayland),
  801. + ozone_platform_wayland || ozone_platform_windzone),
  802. "Must set use_ozone to select ozone platforms")
  803. diff --git a/ui/ozone/platform/headless/headless_surface_factory.cc b/ui/ozone/platform/headless/headless_surface_factory.cc
  804. index 6e64f51c5830..25092dcb2e71 100644
  805. --- a/ui/ozone/platform/headless/headless_surface_factory.cc
  806. +++ b/ui/ozone/platform/headless/headless_surface_factory.cc
  807. @@ -28,6 +28,8 @@ namespace ui {
  808.  
  809. namespace {
  810.  
  811. +const base::FilePath::CharType kDevNull[] = FILE_PATH_LITERAL("/dev/null");
  812. +
  813. void WriteDataToFile(const base::FilePath& location, const SkBitmap& bitmap) {
  814. DCHECK(!location.empty());
  815. std::vector<unsigned char> png_data;
  816. @@ -137,11 +139,19 @@ HeadlessSurfaceFactory::~HeadlessSurfaceFactory() = default;
  817.  
  818. base::FilePath HeadlessSurfaceFactory::GetPathForWidget(
  819. gfx::AcceleratedWidget widget) {
  820. - if (base_path_.empty() || base_path_ == base::FilePath("/dev/null"))
  821. + if (base_path_.empty() || base_path_ == base::FilePath(kDevNull))
  822. return base_path_;
  823.  
  824. // Disambiguate multiple window output files with the window id.
  825. +
  826. +#if defined(OS_WIN)
  827. + std::string path = base::IntToString(reinterpret_cast<int>(widget)) + ".png";
  828. + std::wstring wpath(path.begin(), path.end());
  829. + return base_path_.Append(wpath);
  830. +#else
  831. return base_path_.Append(base::IntToString(widget) + ".png");
  832. +#endif
  833. + // return base_path_.Append(FILE_PATH_LITERAL("123.png"));
  834. }
  835.  
  836. std::vector<gl::GLImplementation>
  837. @@ -177,7 +187,7 @@ void HeadlessSurfaceFactory::CheckBasePath() const {
  838. return;
  839.  
  840. if (!DirectoryExists(base_path_) && !base::CreateDirectory(base_path_) &&
  841. - base_path_ != base::FilePath("/dev/null"))
  842. + base_path_ != base::FilePath(kDevNull))
  843. PLOG(FATAL) << "Unable to create output directory";
  844.  
  845. if (!base::PathIsWritable(base_path_))
  846. diff --git a/ui/ozone/platform/headless/headless_window.cc b/ui/ozone/platform/headless/headless_window.cc
  847. index 3608ffa42555..cbde29375b9f 100644
  848. --- a/ui/ozone/platform/headless/headless_window.cc
  849. +++ b/ui/ozone/platform/headless/headless_window.cc
  850. @@ -6,6 +6,7 @@
  851.  
  852. #include <string>
  853.  
  854. +#include "build/build_config.h"
  855. #include "ui/events/platform/platform_event_source.h"
  856. #include "ui/ozone/platform/headless/headless_window_manager.h"
  857. #include "ui/platform_window/platform_window_delegate.h"
  858. @@ -16,12 +17,20 @@ HeadlessWindow::HeadlessWindow(PlatformWindowDelegate* delegate,
  859. HeadlessWindowManager* manager,
  860. const gfx::Rect& bounds)
  861. : delegate_(delegate), manager_(manager), bounds_(bounds) {
  862. - widget_ = manager_->AddWindow(this);
  863. +#if defined(OS_WIN)
  864. + widget_ = reinterpret_cast<gfx::AcceleratedWidget>(manager_->AddWindow(this));
  865. +#else
  866. + widget_ = static_cast<gfx::AcceleratedWidget>(manager_->AddWindow(this));
  867. +#endif
  868. delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f);
  869. }
  870.  
  871. HeadlessWindow::~HeadlessWindow() {
  872. - manager_->RemoveWindow(widget_, this);
  873. +#if defined(OS_WIN)
  874. + manager_->RemoveWindow(reinterpret_cast<uint64_t>(widget_), this);
  875. +#else
  876. + manager_->RemoveWindow(static_cast<uint64_t>(widget_), this);
  877. +#endif
  878. }
  879.  
  880. gfx::Rect HeadlessWindow::GetBounds() {
  881. diff --git a/ui/ozone/platform/headless/ozone_platform_headless.cc b/ui/ozone/platform/headless/ozone_platform_headless.cc
  882. index 8c569f491313..6bdb21683a13 100644
  883. --- a/ui/ozone/platform/headless/ozone_platform_headless.cc
  884. +++ b/ui/ozone/platform/headless/ozone_platform_headless.cc
  885. @@ -88,7 +88,7 @@ class OzonePlatformHeadless : public OzonePlatform {
  886.  
  887. overlay_manager_ = std::make_unique<StubOverlayManager>();
  888. input_controller_ = CreateStubInputController();
  889. - cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
  890. + // cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
  891. gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
  892. }
  893.  
  894. diff --git a/ui/ozone/platform/windzone/BUILD.gn b/ui/ozone/platform/windzone/BUILD.gn
  895. new file mode 100644
  896. index 000000000000..44b85e1b2d72
  897. --- /dev/null
  898. +++ b/ui/ozone/platform/windzone/BUILD.gn
  899. @@ -0,0 +1,38 @@
  900. +# Copyright 2018 The Chromium Authors. All rights reserved.
  901. +# Use of this source code is governed by a BSD-style license that can be
  902. +# found in the LICENSE file.
  903. +
  904. +visibility = [ "//ui/ozone/*" ]
  905. +
  906. +source_set("windzone") {
  907. + sources = [
  908. + "client_native_pixmap_factory_windzone.cc",
  909. + "client_native_pixmap_factory_windzone.h",
  910. + "ozone_platform_windzone.cc",
  911. + "ozone_platform_windzone.h",
  912. + "windzone_surface_factory.cc",
  913. + "windzone_surface_factory.h",
  914. + "windzone_window.cc",
  915. + "windzone_window.h",
  916. + "windzone_window_manager.cc",
  917. + "windzone_window_manager.h",
  918. + ]
  919. +
  920. + defines = [ "OZONE_IMPLEMENTATION" ]
  921. +
  922. + deps = [
  923. + "//base",
  924. + "//skia",
  925. + "//ui/base",
  926. + "//ui/display/manager",
  927. + "//ui/events",
  928. + "//ui/events/ozone:events_ozone_layout",
  929. + "//ui/events/platform",
  930. + "//ui/gfx/geometry",
  931. + "//ui/gl",
  932. + "//ui/ozone:ozone_base",
  933. + "//ui/ozone/common",
  934. + "//ui/platform_window",
  935. + "//ui/platform_window/win",
  936. + ]
  937. +}
  938. diff --git a/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc
  939. new file mode 100644
  940. index 000000000000..e06374d88c0c
  941. --- /dev/null
  942. +++ b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.cc
  943. @@ -0,0 +1,15 @@
  944. +// Copyright 2018 The Chromium Authors. All rights reserved.
  945. +// Use of this source code is governed by a BSD-style license that can be
  946. +// found in the LICENSE file.
  947. +
  948. +#include "ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h"
  949. +
  950. +#include "ui/ozone/common/stub_client_native_pixmap_factory.h"
  951. +
  952. +namespace ui {
  953. +
  954. +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryWindzone() {
  955. + return CreateStubClientNativePixmapFactory();
  956. +}
  957. +
  958. +} // namespace ui
  959. diff --git a/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h
  960. new file mode 100644
  961. index 000000000000..09bc7cbcb1ed
  962. --- /dev/null
  963. +++ b/ui/ozone/platform/windzone/client_native_pixmap_factory_windzone.h
  964. @@ -0,0 +1,19 @@
  965. +// Copyright 2018 The Chromium Authors. All rights reserved.
  966. +// Use of this source code is governed by a BSD-style license that can be
  967. +// found in the LICENSE file.
  968. +
  969. +#ifndef UI_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
  970. +#define UI_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
  971. +
  972. +namespace gfx {
  973. +class ClientNativePixmapFactory;
  974. +}
  975. +
  976. +namespace ui {
  977. +
  978. +// Constructor hook for use in constructor_list.cc
  979. +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryWindzone();
  980. +
  981. +} // namespace ui
  982. +
  983. +#endif // UI_OZONE_PLATFORM_WINDZONE_CLIENT_NATIVE_PIXMAP_FACTORY_WINDZONE_H_
  984. diff --git a/ui/ozone/platform/windzone/ozone_platform_windzone.cc b/ui/ozone/platform/windzone/ozone_platform_windzone.cc
  985. new file mode 100644
  986. index 000000000000..3bf7b9ba4665
  987. --- /dev/null
  988. +++ b/ui/ozone/platform/windzone/ozone_platform_windzone.cc
  989. @@ -0,0 +1,115 @@
  990. +// Copyright 2018 The Chromium Authors. All rights reserved.
  991. +// Use of this source code is governed by a BSD-style license that can be
  992. +// found in the LICENSE file.
  993. +
  994. +#include "ui/ozone/platform/windzone/ozone_platform_windzone.h"
  995. +
  996. +#include "base/command_line.h"
  997. +#include "base/files/file_path.h"
  998. +#include "base/macros.h"
  999. +#include "base/memory/ptr_util.h"
  1000. +#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
  1001. +#include "ui/display/manager/fake_display_delegate.h"
  1002. +#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
  1003. +#include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
  1004. +#include "ui/events/platform/platform_event_source.h"
  1005. +#include "ui/events/system_input_injector.h"
  1006. +#include "ui/ozone/common/stub_overlay_manager.h"
  1007. +#include "ui/ozone/platform/windzone/windzone_surface_factory.h"
  1008. +#include "ui/ozone/platform/windzone/windzone_window.h"
  1009. +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
  1010. +#include "ui/ozone/public/cursor_factory_ozone.h"
  1011. +#include "ui/ozone/public/gpu_platform_support_host.h"
  1012. +#include "ui/ozone/public/input_controller.h"
  1013. +#include "ui/ozone/public/ozone_platform.h"
  1014. +#include "ui/ozone/public/ozone_switches.h"
  1015. +
  1016. +namespace ui {
  1017. +
  1018. +namespace {
  1019. +
  1020. +// dummy class
  1021. +class WindzonePlatformEventSource : public ui::PlatformEventSource {
  1022. + public:
  1023. + WindzonePlatformEventSource() = default;
  1024. + ~WindzonePlatformEventSource() override = default;
  1025. +
  1026. + private:
  1027. + DISALLOW_COPY_AND_ASSIGN(WindzonePlatformEventSource);
  1028. +};
  1029. +
  1030. +// OzonePlatform for Windows
  1031. +class OzonePlatformWindzone : public OzonePlatform {
  1032. + public:
  1033. + OzonePlatformWindzone() {}
  1034. +
  1035. + ~OzonePlatformWindzone() override {}
  1036. +
  1037. + // OzonePlatform:
  1038. + ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
  1039. + return surface_factory_.get();
  1040. + }
  1041. + OverlayManagerOzone* GetOverlayManager() override {
  1042. + return overlay_manager_.get();
  1043. + }
  1044. + CursorFactoryOzone* GetCursorFactoryOzone() override {
  1045. + return cursor_factory_ozone_.get();
  1046. + }
  1047. + InputController* GetInputController() override {
  1048. + return input_controller_.get();
  1049. + }
  1050. + GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
  1051. + return gpu_platform_support_host_.get();
  1052. + }
  1053. + std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
  1054. + return nullptr; // no input injection support.
  1055. + }
  1056. + std::unique_ptr<PlatformWindow> CreatePlatformWindow(
  1057. + PlatformWindowDelegate* delegate,
  1058. + const gfx::Rect& bounds) override {
  1059. + return std::make_unique<WindzoneWindow>(delegate, bounds);
  1060. + }
  1061. + std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
  1062. + override {
  1063. + return std::make_unique<display::FakeDisplayDelegate>();
  1064. + }
  1065. +
  1066. + void InitializeUI(const InitParams& params) override {
  1067. + window_manager_ = std::make_unique<WindzoneWindowManager>();
  1068. + surface_factory_ = std::make_unique<WindzoneSurfaceFactory>();
  1069. + // This unbreaks tests that create their own.
  1070. + if (!PlatformEventSource::GetInstance())
  1071. + platform_event_source_ = std::make_unique<WindzonePlatformEventSource>();
  1072. + KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
  1073. + std::make_unique<StubKeyboardLayoutEngine>());
  1074. +
  1075. + overlay_manager_ = std::make_unique<StubOverlayManager>();
  1076. + input_controller_ = CreateStubInputController();
  1077. + // cursor_factory_ozone_ = std::make_unique<BitmapCursorFactoryOzone>();
  1078. + gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
  1079. + }
  1080. +
  1081. + void InitializeGPU(const InitParams& params) override {
  1082. + if (!surface_factory_)
  1083. + surface_factory_ = std::make_unique<WindzoneSurfaceFactory>();
  1084. + }
  1085. +
  1086. + private:
  1087. + std::unique_ptr<WindzoneWindowManager> window_manager_;
  1088. + std::unique_ptr<WindzoneSurfaceFactory> surface_factory_;
  1089. + std::unique_ptr<PlatformEventSource> platform_event_source_;
  1090. + std::unique_ptr<CursorFactoryOzone> cursor_factory_ozone_;
  1091. + std::unique_ptr<InputController> input_controller_;
  1092. + std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
  1093. + std::unique_ptr<OverlayManagerOzone> overlay_manager_;
  1094. +
  1095. + DISALLOW_COPY_AND_ASSIGN(OzonePlatformWindzone);
  1096. +};
  1097. +
  1098. +} // namespace
  1099. +
  1100. +OzonePlatform* CreateOzonePlatformWindzone() {
  1101. + return new OzonePlatformWindzone;
  1102. +}
  1103. +
  1104. +} // namespace ui
  1105. diff --git a/ui/ozone/platform/windzone/ozone_platform_windzone.h b/ui/ozone/platform/windzone/ozone_platform_windzone.h
  1106. new file mode 100644
  1107. index 000000000000..004a12a176c9
  1108. --- /dev/null
  1109. +++ b/ui/ozone/platform/windzone/ozone_platform_windzone.h
  1110. @@ -0,0 +1,17 @@
  1111. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1112. +// Use of this source code is governed by a BSD-style license that can be
  1113. +// found in the LICENSE file.
  1114. +
  1115. +#ifndef UI_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
  1116. +#define UI_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
  1117. +
  1118. +namespace ui {
  1119. +
  1120. +class OzonePlatform;
  1121. +
  1122. +// Constructor hook for use in ozone_platform_list.cc
  1123. +OzonePlatform* CreateOzonePlatformWindzone();
  1124. +
  1125. +} // namespace ui
  1126. +
  1127. +#endif // UI_OZONE_PLATFORM_WINDZONE_OZONE_PLATFORM_WINDZONE_H_
  1128. diff --git a/ui/ozone/platform/windzone/windzone_surface_factory.cc b/ui/ozone/platform/windzone/windzone_surface_factory.cc
  1129. new file mode 100644
  1130. index 000000000000..f5f1d6cd2a27
  1131. --- /dev/null
  1132. +++ b/ui/ozone/platform/windzone/windzone_surface_factory.cc
  1133. @@ -0,0 +1,67 @@
  1134. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1135. +// Use of this source code is governed by a BSD-style license that can be
  1136. +// found in the LICENSE file.
  1137. +
  1138. +#include "ui/ozone/platform/windzone/windzone_surface_factory.h"
  1139. +
  1140. +#include "base/bind.h"
  1141. +#include "base/files/file_util.h"
  1142. +#include "base/location.h"
  1143. +#include "base/macros.h"
  1144. +#include "base/memory/ptr_util.h"
  1145. +#include "base/strings/string_number_conversions.h"
  1146. +#include "base/task_scheduler/post_task.h"
  1147. +#include "build/build_config.h"
  1148. +#include "ui/gfx/codec/png_codec.h"
  1149. +#include "ui/gfx/skia_util.h"
  1150. +#include "ui/gfx/vsync_provider.h"
  1151. +#include "ui/gl/gl_surface_osmesa_win.h"
  1152. +#include "ui/ozone/common/egl_util.h"
  1153. +#include "ui/ozone/common/gl_ozone_egl.h"
  1154. +#include "ui/ozone/common/gl_ozone_osmesa.h"
  1155. +#include "ui/ozone/platform/windzone/windzone_window.h"
  1156. +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
  1157. +
  1158. +namespace ui {
  1159. +
  1160. +namespace {
  1161. +
  1162. +class GLOzoneOSMesaWindzone : public GLOzoneOSMesa {
  1163. + public:
  1164. + GLOzoneOSMesaWindzone() = default;
  1165. + ~GLOzoneOSMesaWindzone() override = default;
  1166. +
  1167. + // GLOzone:
  1168. + scoped_refptr<gl::GLSurface> CreateViewGLSurface(
  1169. + gfx::AcceleratedWidget window) override {
  1170. + return gl::InitializeGLSurface(new gl::GLSurfaceOSMesaWin(window));
  1171. + }
  1172. +
  1173. + // TODO(camurcu): Implement CreateOffscreenGLSurface().
  1174. +
  1175. + DISALLOW_COPY_AND_ASSIGN(GLOzoneOSMesaWindzone);
  1176. +};
  1177. +
  1178. +} // namespace
  1179. +
  1180. +WindzoneSurfaceFactory::WindzoneSurfaceFactory()
  1181. + : osmesa_implementation_(std::make_unique<GLOzoneOSMesaWindzone>()) {}
  1182. +
  1183. +WindzoneSurfaceFactory::~WindzoneSurfaceFactory() = default;
  1184. +
  1185. +std::vector<gl::GLImplementation>
  1186. +WindzoneSurfaceFactory::GetAllowedGLImplementations() {
  1187. + return std::vector<gl::GLImplementation>{gl::kGLImplementationOSMesaGL};
  1188. +}
  1189. +
  1190. +GLOzone* WindzoneSurfaceFactory::GetGLOzone(
  1191. + gl::GLImplementation implementation) {
  1192. + switch (implementation) {
  1193. + case gl::kGLImplementationOSMesaGL:
  1194. + return osmesa_implementation_.get();
  1195. + default:
  1196. + return nullptr;
  1197. + }
  1198. +}
  1199. +
  1200. +} // namespace ui
  1201. diff --git a/ui/ozone/platform/windzone/windzone_surface_factory.h b/ui/ozone/platform/windzone/windzone_surface_factory.h
  1202. new file mode 100644
  1203. index 000000000000..539d271c10f3
  1204. --- /dev/null
  1205. +++ b/ui/ozone/platform/windzone/windzone_surface_factory.h
  1206. @@ -0,0 +1,36 @@
  1207. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1208. +// Use of this source code is governed by a BSD-style license that can be
  1209. +// found in the LICENSE file.
  1210. +
  1211. +#ifndef UI_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
  1212. +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
  1213. +
  1214. +#include <memory>
  1215. +#include <vector>
  1216. +
  1217. +#include "base/files/file_path.h"
  1218. +#include "base/macros.h"
  1219. +#include "ui/ozone/public/gl_ozone.h"
  1220. +#include "ui/ozone/public/surface_factory_ozone.h"
  1221. +
  1222. +namespace ui {
  1223. +
  1224. +// Handles GL initialization and surface/context creation for Windzone
  1225. +class WindzoneSurfaceFactory : public SurfaceFactoryOzone {
  1226. + public:
  1227. + WindzoneSurfaceFactory();
  1228. + ~WindzoneSurfaceFactory() override;
  1229. +
  1230. + // SurfaceFactoryOzone:
  1231. + std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
  1232. + GLOzone* GetGLOzone(gl::GLImplementation implementation) override;
  1233. +
  1234. + private:
  1235. + std::unique_ptr<GLOzone> osmesa_implementation_;
  1236. +
  1237. + DISALLOW_COPY_AND_ASSIGN(WindzoneSurfaceFactory);
  1238. +};
  1239. +
  1240. +} // namespace ui
  1241. +
  1242. +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_SURFACE_FACTORY_H_
  1243. diff --git a/ui/ozone/platform/windzone/windzone_window.cc b/ui/ozone/platform/windzone/windzone_window.cc
  1244. new file mode 100644
  1245. index 000000000000..0e17ff031df8
  1246. --- /dev/null
  1247. +++ b/ui/ozone/platform/windzone/windzone_window.cc
  1248. @@ -0,0 +1,22 @@
  1249. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1250. +// Use of this source code is governed by a BSD-style license that can be
  1251. +// found in the LICENSE file.
  1252. +
  1253. +#include "ui/ozone/platform/windzone/windzone_window.h"
  1254. +
  1255. +#include <string>
  1256. +
  1257. +#include "build/build_config.h"
  1258. +#include "ui/events/platform/platform_event_source.h"
  1259. +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
  1260. +#include "ui/platform_window/platform_window_delegate.h"
  1261. +
  1262. +namespace ui {
  1263. +
  1264. +WindzoneWindow::WindzoneWindow(PlatformWindowDelegate* delegate,
  1265. + const gfx::Rect& bounds)
  1266. + : WinWindow(delegate, bounds) {}
  1267. +
  1268. +WindzoneWindow::~WindzoneWindow() {}
  1269. +
  1270. +} // namespace ui
  1271. diff --git a/ui/ozone/platform/windzone/windzone_window.h b/ui/ozone/platform/windzone/windzone_window.h
  1272. new file mode 100644
  1273. index 000000000000..cde23ef66a18
  1274. --- /dev/null
  1275. +++ b/ui/ozone/platform/windzone/windzone_window.h
  1276. @@ -0,0 +1,29 @@
  1277. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1278. +// Use of this source code is governed by a BSD-style license that can be
  1279. +// found in the LICENSE file.
  1280. +
  1281. +#ifndef UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
  1282. +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
  1283. +
  1284. +#include "base/macros.h"
  1285. +#include "ui/gfx/geometry/rect.h"
  1286. +#include "ui/gfx/native_widget_types.h"
  1287. +#include "ui/platform_window/win/win_window.h"
  1288. +
  1289. +namespace ui {
  1290. +
  1291. +class PlatformWindowDelegate;
  1292. +class WindzoneWindowManager;
  1293. +
  1294. +class WindzoneWindow : public WinWindow {
  1295. + public:
  1296. + WindzoneWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);
  1297. + ~WindzoneWindow() override;
  1298. +
  1299. + private:
  1300. + DISALLOW_COPY_AND_ASSIGN(WindzoneWindow);
  1301. +};
  1302. +
  1303. +} // namespace ui
  1304. +
  1305. +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_H_
  1306. diff --git a/ui/ozone/platform/windzone/windzone_window_manager.cc b/ui/ozone/platform/windzone/windzone_window_manager.cc
  1307. new file mode 100644
  1308. index 000000000000..6b1040ce363b
  1309. --- /dev/null
  1310. +++ b/ui/ozone/platform/windzone/windzone_window_manager.cc
  1311. @@ -0,0 +1,29 @@
  1312. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1313. +// Use of this source code is governed by a BSD-style license that can be
  1314. +// found in the LICENSE file.
  1315. +
  1316. +#include "ui/ozone/platform/windzone/windzone_window_manager.h"
  1317. +
  1318. +namespace ui {
  1319. +
  1320. +WindzoneWindowManager::WindzoneWindowManager() = default;
  1321. +
  1322. +WindzoneWindowManager::~WindzoneWindowManager() {
  1323. + DCHECK(thread_checker_.CalledOnValidThread());
  1324. +}
  1325. +
  1326. +int32_t WindzoneWindowManager::AddWindow(WindzoneWindow* window) {
  1327. + return windows_.Add(window);
  1328. +}
  1329. +
  1330. +void WindzoneWindowManager::RemoveWindow(int32_t window_id,
  1331. + WindzoneWindow* window) {
  1332. + DCHECK_EQ(window, windows_.Lookup(window_id));
  1333. + windows_.Remove(window_id);
  1334. +}
  1335. +
  1336. +WindzoneWindow* WindzoneWindowManager::GetWindow(int32_t window_id) {
  1337. + return windows_.Lookup(window_id);
  1338. +}
  1339. +
  1340. +} // namespace ui
  1341. diff --git a/ui/ozone/platform/windzone/windzone_window_manager.h b/ui/ozone/platform/windzone/windzone_window_manager.h
  1342. new file mode 100644
  1343. index 000000000000..a7c7a3c4b4dc
  1344. --- /dev/null
  1345. +++ b/ui/ozone/platform/windzone/windzone_window_manager.h
  1346. @@ -0,0 +1,46 @@
  1347. +// Copyright 2018 The Chromium Authors. All rights reserved.
  1348. +// Use of this source code is governed by a BSD-style license that can be
  1349. +// found in the LICENSE file.
  1350. +
  1351. +#ifndef UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
  1352. +#define UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
  1353. +
  1354. +#include <stdint.h>
  1355. +
  1356. +#include <memory>
  1357. +
  1358. +#include "base/containers/id_map.h"
  1359. +#include "base/files/file_path.h"
  1360. +#include "base/macros.h"
  1361. +#include "base/threading/thread_checker.h"
  1362. +#include "ui/gfx/native_widget_types.h"
  1363. +#include "ui/ozone/public/surface_factory_ozone.h"
  1364. +
  1365. +namespace ui {
  1366. +
  1367. +class WindzoneWindow;
  1368. +
  1369. +class WindzoneWindowManager {
  1370. + public:
  1371. + WindzoneWindowManager();
  1372. + ~WindzoneWindowManager();
  1373. +
  1374. + // Register a new window. Returns the window id.
  1375. + int32_t AddWindow(WindzoneWindow* window);
  1376. +
  1377. + // Remove a window.
  1378. + void RemoveWindow(int32_t window_id, WindzoneWindow* window);
  1379. +
  1380. + // Find a window object by id;
  1381. + WindzoneWindow* GetWindow(int32_t window_id);
  1382. +
  1383. + private:
  1384. + base::IDMap<WindzoneWindow*> windows_;
  1385. + base::ThreadChecker thread_checker_;
  1386. +
  1387. + DISALLOW_COPY_AND_ASSIGN(WindzoneWindowManager);
  1388. +};
  1389. +
  1390. +} // namespace ui
  1391. +
  1392. +#endif // UI_OZONE_PLATFORM_WINDZONE_WINDZONE_WINDOW_MANAGER_H_
  1393. diff --git a/ui/platform_window/win/win_window.cc b/ui/platform_window/win/win_window.cc
  1394. index 2f32390a5f5d..2d2d88dea757 100644
  1395. --- a/ui/platform_window/win/win_window.cc
  1396. +++ b/ui/platform_window/win/win_window.cc
  1397. @@ -119,7 +119,7 @@ void WinWindow::Minimize() {}
  1398. void WinWindow::Restore() {}
  1399.  
  1400. void WinWindow::SetCursor(PlatformCursor cursor) {
  1401. - ::SetCursor(cursor);
  1402. + //::SetCursor(cursor);
  1403. }
  1404.  
  1405. void WinWindow::MoveCursorTo(const gfx::Point& location) {}
  1406. @@ -132,15 +132,15 @@ PlatformImeController* WinWindow::GetPlatformImeController() {
  1407. }
  1408.  
  1409. LRESULT WinWindow::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) {
  1410. - MSG msg = { hwnd(), message, w_param, l_param,
  1411. - static_cast<DWORD>(GetMessageTime()),
  1412. - { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
  1413. - std::unique_ptr<Event> event = EventFromNative(msg);
  1414. - if (IsMouseEventFromTouch(message))
  1415. - event->set_flags(event->flags() | EF_FROM_TOUCH);
  1416. - if (!(event->flags() & ui::EF_IS_NON_CLIENT))
  1417. - delegate_->DispatchEvent(event.get());
  1418. - SetMsgHandled(event->handled());
  1419. + // MSG msg = { hwnd(), message, w_param, l_param,
  1420. + // static_cast<DWORD>(GetMessageTime()),
  1421. + // { CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param) } };
  1422. + // std::unique_ptr<Event> event = EventFromNative(msg);
  1423. + // if (IsMouseEventFromTouch(message))
  1424. + // event->set_flags(event->flags() | EF_FROM_TOUCH);
  1425. + // if (!(event->flags() & ui::EF_IS_NON_CLIENT))
  1426. + // delegate_->DispatchEvent(event.get());
  1427. + // SetMsgHandled(event->handled());
  1428. return 0;
  1429. }
  1430.  
  1431. @@ -152,10 +152,10 @@ LRESULT WinWindow::OnCaptureChanged(UINT message,
  1432. }
  1433.  
  1434. LRESULT WinWindow::OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param) {
  1435. - MSG msg = { hwnd(), message, w_param, l_param };
  1436. - KeyEvent event(msg);
  1437. - delegate_->DispatchEvent(&event);
  1438. - SetMsgHandled(event.handled());
  1439. + // MSG msg = { hwnd(), message, w_param, l_param };
  1440. + // KeyEvent event(msg);
  1441. + // delegate_->DispatchEvent(&event);
  1442. + // SetMsgHandled(event.handled());
  1443. return 0;
  1444. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement