| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 | 272 |
| 273 namespace { | 273 namespace { |
| 274 | 274 |
| 275 void updatePolicyForEvent(const WebInputEvent* inputEvent, | 275 void updatePolicyForEvent(const WebInputEvent* inputEvent, |
| 276 NavigationPolicy* policy) { | 276 NavigationPolicy* policy) { |
| 277 if (!inputEvent) | 277 if (!inputEvent) |
| 278 return; | 278 return; |
| 279 | 279 |
| 280 unsigned short buttonNumber = 0; | 280 unsigned short buttonNumber = 0; |
| 281 if (inputEvent->type == WebInputEvent::MouseUp) { | 281 if (inputEvent->type() == WebInputEvent::MouseUp) { |
| 282 const WebMouseEvent* mouseEvent = | 282 const WebMouseEvent* mouseEvent = |
| 283 static_cast<const WebMouseEvent*>(inputEvent); | 283 static_cast<const WebMouseEvent*>(inputEvent); |
| 284 | 284 |
| 285 switch (mouseEvent->button) { | 285 switch (mouseEvent->button) { |
| 286 case WebMouseEvent::Button::Left: | 286 case WebMouseEvent::Button::Left: |
| 287 buttonNumber = 0; | 287 buttonNumber = 0; |
| 288 break; | 288 break; |
| 289 case WebMouseEvent::Button::Middle: | 289 case WebMouseEvent::Button::Middle: |
| 290 buttonNumber = 1; | 290 buttonNumber = 1; |
| 291 break; | 291 break; |
| 292 case WebMouseEvent::Button::Right: | 292 case WebMouseEvent::Button::Right: |
| 293 buttonNumber = 2; | 293 buttonNumber = 2; |
| 294 break; | 294 break; |
| 295 default: | 295 default: |
| 296 return; | 296 return; |
| 297 } | 297 } |
| 298 } else if ((WebInputEvent::isKeyboardEventType(inputEvent->type) && | 298 } else if ((WebInputEvent::isKeyboardEventType(inputEvent->type()) && |
| 299 static_cast<const WebKeyboardEvent*>(inputEvent) | 299 static_cast<const WebKeyboardEvent*>(inputEvent) |
| 300 ->windowsKeyCode == VKEY_RETURN) || | 300 ->windowsKeyCode == VKEY_RETURN) || |
| 301 WebInputEvent::isGestureEventType(inputEvent->type)) { | 301 WebInputEvent::isGestureEventType(inputEvent->type())) { |
| 302 // Keyboard and gesture events can simulate mouse events. | 302 // Keyboard and gesture events can simulate mouse events. |
| 303 buttonNumber = 0; | 303 buttonNumber = 0; |
| 304 } else { | 304 } else { |
| 305 return; | 305 return; |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool ctrl = inputEvent->modifiers & WebInputEvent::ControlKey; | 308 bool ctrl = inputEvent->modifiers() & WebInputEvent::ControlKey; |
| 309 bool shift = inputEvent->modifiers & WebInputEvent::ShiftKey; | 309 bool shift = inputEvent->modifiers() & WebInputEvent::ShiftKey; |
| 310 bool alt = inputEvent->modifiers & WebInputEvent::AltKey; | 310 bool alt = inputEvent->modifiers() & WebInputEvent::AltKey; |
| 311 bool meta = inputEvent->modifiers & WebInputEvent::MetaKey; | 311 bool meta = inputEvent->modifiers() & WebInputEvent::MetaKey; |
| 312 | 312 |
| 313 NavigationPolicy userPolicy = *policy; | 313 NavigationPolicy userPolicy = *policy; |
| 314 navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, | 314 navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, |
| 315 &userPolicy); | 315 &userPolicy); |
| 316 | 316 |
| 317 // When the input event suggests a download, but the navigation was initiated | 317 // When the input event suggests a download, but the navigation was initiated |
| 318 // by script, we should not override it. | 318 // by script, we should not override it. |
| 319 if (userPolicy == NavigationPolicyDownload && | 319 if (userPolicy == NavigationPolicyDownload && |
| 320 *policy != NavigationPolicyIgnore) | 320 *policy != NavigationPolicyIgnore) |
| 321 return; | 321 return; |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 PresentationController::provideTo(frame, client->presentationClient()); | 1164 PresentationController::provideTo(frame, client->presentationClient()); |
| 1165 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { | 1165 if (RuntimeEnabledFeatures::audioOutputDevicesEnabled()) { |
| 1166 provideAudioOutputDeviceClientTo(frame, | 1166 provideAudioOutputDeviceClientTo(frame, |
| 1167 new AudioOutputDeviceClientImpl(frame)); | 1167 new AudioOutputDeviceClientImpl(frame)); |
| 1168 } | 1168 } |
| 1169 if (RuntimeEnabledFeatures::installedAppEnabled()) | 1169 if (RuntimeEnabledFeatures::installedAppEnabled()) |
| 1170 InstalledAppController::provideTo(frame, client->installedAppClient()); | 1170 InstalledAppController::provideTo(frame, client->installedAppClient()); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 } // namespace blink | 1173 } // namespace blink |
| OLD | NEW |