| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (!document.frame() || !document.frame()->domWindow()) | 75 if (!document.frame() || !document.frame()->domWindow()) |
| 76 return 0; | 76 return 0; |
| 77 Navigator& navigator = *document.frame()->domWindow()->navigator(); | 77 Navigator& navigator = *document.frame()->domWindow()->navigator(); |
| 78 return &from(navigator); | 78 return &from(navigator); |
| 79 } | 79 } |
| 80 | 80 |
| 81 NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator) | 81 NavigatorGamepad& NavigatorGamepad::from(Navigator& navigator) |
| 82 { | 82 { |
| 83 NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); | 83 NavigatorGamepad* supplement = static_cast<NavigatorGamepad*>(WillBeHeapSupp
lement<Navigator>::from(navigator, supplementName())); |
| 84 if (!supplement) { | 84 if (!supplement) { |
| 85 supplement = new NavigatorGamepad(navigator.frame()); | 85 supplement = new NavigatorGamepad(navigator.localFrame()); |
| 86 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); | 86 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); |
| 87 } | 87 } |
| 88 return *supplement; | 88 return *supplement; |
| 89 } | 89 } |
| 90 | 90 |
| 91 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator) | 91 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator) |
| 92 { | 92 { |
| 93 return NavigatorGamepad::from(navigator).gamepads(); | 93 return NavigatorGamepad::from(navigator).gamepads(); |
| 94 } | 94 } |
| 95 | 95 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 279 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 280 m_pendingEvents.append(newGamepad); | 280 m_pendingEvents.append(newGamepad); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 if (!m_pendingEvents.isEmpty()) | 284 if (!m_pendingEvents.isEmpty()) |
| 285 m_dispatchOneEventRunner.runAsync(); | 285 m_dispatchOneEventRunner.runAsync(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace blink | 288 } // namespace blink |
| OLD | NEW |