Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 m_webFrame->didFinish(); 462 m_webFrame->didFinish();
463 } 463 }
464 464
465 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() { 465 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() {
466 if (m_webFrame->client()) 466 if (m_webFrame->client())
467 m_webFrame->client()->didChangeThemeColor(); 467 m_webFrame->client()->didChangeThemeColor();
468 } 468 }
469 469
470 static bool allowCreatingBackgroundTabs() { 470 static bool allowCreatingBackgroundTabs() {
471 const WebInputEvent* inputEvent = WebViewImpl::currentInputEvent(); 471 const WebInputEvent* inputEvent = WebViewImpl::currentInputEvent();
472 if (!inputEvent || (inputEvent->type != WebInputEvent::MouseUp && 472 if (!inputEvent || (inputEvent->type() != WebInputEvent::MouseUp &&
473 (inputEvent->type != WebInputEvent::RawKeyDown && 473 (inputEvent->type() != WebInputEvent::RawKeyDown &&
474 inputEvent->type != WebInputEvent::KeyDown) && 474 inputEvent->type() != WebInputEvent::KeyDown) &&
475 inputEvent->type != WebInputEvent::GestureTap)) 475 inputEvent->type() != WebInputEvent::GestureTap))
476 return false; 476 return false;
477 477
478 unsigned short buttonNumber; 478 unsigned short buttonNumber;
479 if (WebInputEvent::isMouseEventType(inputEvent->type)) { 479 if (WebInputEvent::isMouseEventType(inputEvent->type())) {
480 const WebMouseEvent* mouseEvent = 480 const WebMouseEvent* mouseEvent =
481 static_cast<const WebMouseEvent*>(inputEvent); 481 static_cast<const WebMouseEvent*>(inputEvent);
482 482
483 switch (mouseEvent->button) { 483 switch (mouseEvent->button) {
484 case WebMouseEvent::Button::Left: 484 case WebMouseEvent::Button::Left:
485 buttonNumber = 0; 485 buttonNumber = 0;
486 break; 486 break;
487 case WebMouseEvent::Button::Middle: 487 case WebMouseEvent::Button::Middle:
488 buttonNumber = 1; 488 buttonNumber = 1;
489 break; 489 break;
490 case WebMouseEvent::Button::Right: 490 case WebMouseEvent::Button::Right:
491 buttonNumber = 2; 491 buttonNumber = 2;
492 break; 492 break;
493 default: 493 default:
494 return false; 494 return false;
495 } 495 }
496 } else { 496 } else {
497 // The click is simulated when triggering the keypress event. 497 // The click is simulated when triggering the keypress event.
498 buttonNumber = 0; 498 buttonNumber = 0;
499 } 499 }
500 bool ctrl = inputEvent->modifiers & WebMouseEvent::ControlKey; 500 bool ctrl = inputEvent->modifiers() & WebMouseEvent::ControlKey;
501 bool shift = inputEvent->modifiers & WebMouseEvent::ShiftKey; 501 bool shift = inputEvent->modifiers() & WebMouseEvent::ShiftKey;
502 bool alt = inputEvent->modifiers & WebMouseEvent::AltKey; 502 bool alt = inputEvent->modifiers() & WebMouseEvent::AltKey;
503 bool meta = inputEvent->modifiers & WebMouseEvent::MetaKey; 503 bool meta = inputEvent->modifiers() & WebMouseEvent::MetaKey;
504 504
505 NavigationPolicy userPolicy; 505 NavigationPolicy userPolicy;
506 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, 506 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta,
507 &userPolicy)) 507 &userPolicy))
508 return false; 508 return false;
509 return userPolicy == NavigationPolicyNewBackgroundTab; 509 return userPolicy == NavigationPolicyNewBackgroundTab;
510 } 510 }
511 511
512 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation( 512 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation(
513 const ResourceRequest& request, 513 const ResourceRequest& request,
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() { 998 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() {
999 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) 999 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot())
1000 ->devToolsAgentImpl(); 1000 ->devToolsAgentImpl();
1001 } 1001 }
1002 1002
1003 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1003 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
1004 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1004 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
1005 } 1005 }
1006 1006
1007 } // namespace blink 1007 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/ExternalPopupMenu.cpp ('k') | third_party/WebKit/Source/web/InspectorOverlay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698