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

Side by Side Diff: Source/web/ChromeClientImpl.cpp

Issue 1152413003: General code cleanup of ChromeClient-related classes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 void ChromeClientImpl::setWindowRect(const IntRect& r) 139 void ChromeClientImpl::setWindowRect(const IntRect& r)
140 { 140 {
141 if (m_webView->client()) 141 if (m_webView->client())
142 m_webView->client()->setWindowRect(r); 142 m_webView->client()->setWindowRect(r);
143 } 143 }
144 144
145 IntRect ChromeClientImpl::windowRect() 145 IntRect ChromeClientImpl::windowRect()
146 { 146 {
147 WebRect rect; 147 WebRect rect;
148 if (m_webView->client()) 148 if (m_webView->client()) {
149 rect = m_webView->client()->rootWindowRect(); 149 rect = m_webView->client()->rootWindowRect();
150 else { 150 } else {
151 // These numbers will be fairly wrong. The window's x/y coordinates will 151 // These numbers will be fairly wrong. The window's x/y coordinates will
152 // be the top left corner of the screen and the size will be the content 152 // be the top left corner of the screen and the size will be the content
153 // size instead of the window size. 153 // size instead of the window size.
154 rect.width = m_webView->size().width; 154 rect.width = m_webView->size().width;
155 rect.height = m_webView->size().height; 155 rect.height = m_webView->size().height;
156 } 156 }
157 return IntRect(rect); 157 return IntRect(rect);
158 } 158 }
159 159
160 IntRect ChromeClientImpl::pageRect() 160 IntRect ChromeClientImpl::pageRect()
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 WebViewImpl* newView = toWebViewImpl( 295 WebViewImpl* newView = toWebViewImpl(
296 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSendReferrer == NeverSendReferrer)); 296 m_webView->client()->createView(WebLocalFrameImpl::fromFrame(frame), Wra ppedResourceRequest(r.resourceRequest()), features, r.frameName(), policy, shoul dSendReferrer == NeverSendReferrer));
297 if (!newView) 297 if (!newView)
298 return nullptr; 298 return nullptr;
299 return newView->page(); 299 return newView->page();
300 } 300 }
301 301
302 void ChromeClientImpl::show(NavigationPolicy navigationPolicy) 302 void ChromeClientImpl::show(NavigationPolicy navigationPolicy)
303 { 303 {
304 if (!m_webView->client()) 304 if (m_webView->client())
305 return; 305 m_webView->client()->show(effectiveNavigationPolicy(navigationPolicy, m_ windowFeatures));
306
307 WebNavigationPolicy policy = effectiveNavigationPolicy(navigationPolicy, m_w indowFeatures);
308 m_webView->client()->show(policy);
309 } 306 }
310 307
311 void ChromeClientImpl::setToolbarsVisible(bool value) 308 void ChromeClientImpl::setToolbarsVisible(bool value)
312 { 309 {
313 m_windowFeatures.toolBarVisible = value; 310 m_windowFeatures.toolBarVisible = value;
314 } 311 }
315 312
316 bool ChromeClientImpl::toolbarsVisible() 313 bool ChromeClientImpl::toolbarsVisible()
317 { 314 {
318 return m_windowFeatures.toolBarVisible; 315 return m_windowFeatures.toolBarVisible;
319 } 316 }
320 317
321 void ChromeClientImpl::setStatusbarVisible(bool value) 318 void ChromeClientImpl::setStatusbarVisible(bool value)
322 { 319 {
323 m_windowFeatures.statusBarVisible = value; 320 m_windowFeatures.statusBarVisible = value;
324 } 321 }
325 322
326 bool ChromeClientImpl::statusbarVisible() 323 bool ChromeClientImpl::statusbarVisible()
327 { 324 {
328 return m_windowFeatures.statusBarVisible; 325 return m_windowFeatures.statusBarVisible;
329 } 326 }
330 327
331 void ChromeClientImpl::setScrollbarsVisible(bool value) 328 void ChromeClientImpl::setScrollbarsVisible(bool value)
332 { 329 {
333 m_windowFeatures.scrollbarsVisible = value; 330 m_windowFeatures.scrollbarsVisible = value;
334 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame()); 331 if (WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame() ))
335 if (webFrame)
336 webFrame->setCanHaveScrollbars(value); 332 webFrame->setCanHaveScrollbars(value);
337 } 333 }
338 334
339 bool ChromeClientImpl::scrollbarsVisible() 335 bool ChromeClientImpl::scrollbarsVisible()
340 { 336 {
341 return m_windowFeatures.scrollbarsVisible; 337 return m_windowFeatures.scrollbarsVisible;
342 } 338 }
343 339
344 void ChromeClientImpl::setMenubarVisible(bool value) 340 void ChromeClientImpl::setMenubarVisible(bool value)
345 { 341 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel() 373 bool ChromeClientImpl::canRunBeforeUnloadConfirmPanel()
378 { 374 {
379 return !!m_webView->client(); 375 return !!m_webView->client();
380 } 376 }
381 377
382 bool ChromeClientImpl::runBeforeUnloadConfirmPanelInternal(LocalFrame* frame, co nst String& message) 378 bool ChromeClientImpl::runBeforeUnloadConfirmPanelInternal(LocalFrame* frame, co nst String& message)
383 { 379 {
384 notifyPopupOpeningObservers(); 380 notifyPopupOpeningObservers();
385 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame); 381 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
386 382
387 bool isReload = false;
388 WebDataSource* ds = webframe->provisionalDataSource(); 383 WebDataSource* ds = webframe->provisionalDataSource();
389 if (ds) 384 bool isReload = ds && (ds->navigationType() == WebNavigationTypeReload);
390 isReload = (ds->navigationType() == WebNavigationTypeReload);
391 385
392 if (webframe->client()) 386 if (webframe->client())
393 return webframe->client()->runModalBeforeUnloadDialog(isReload, message) ; 387 return webframe->client()->runModalBeforeUnloadDialog(isReload, message) ;
394 return false; 388 return false;
395 } 389 }
396 390
397 void ChromeClientImpl::closeWindowSoon() 391 void ChromeClientImpl::closeWindowSoon()
398 { 392 {
399 // Make sure this Page can no longer be found by JS. 393 // Make sure this Page can no longer be found by JS.
400 Page::ordinaryPages().remove(m_webView->page()); 394 Page::ordinaryPages().remove(m_webView->page());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 428
435 // See comments for runJavaScriptAlert(). 429 // See comments for runJavaScriptAlert().
436 bool ChromeClientImpl::runJavaScriptPromptInternal(LocalFrame* frame, const Stri ng& message, const String& defaultValue, String& result) 430 bool ChromeClientImpl::runJavaScriptPromptInternal(LocalFrame* frame, const Stri ng& message, const String& defaultValue, String& result)
437 { 431 {
438 notifyPopupOpeningObservers(); 432 notifyPopupOpeningObservers();
439 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame); 433 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
440 if (webframe->client()) { 434 if (webframe->client()) {
441 if (WebUserGestureIndicator::isProcessingUserGesture()) 435 if (WebUserGestureIndicator::isProcessingUserGesture())
442 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt(); 436 WebUserGestureIndicator::currentUserGestureToken().setJavascriptProm pt();
443 WebString actualValue; 437 WebString actualValue;
444 bool ok = webframe->client()->runModalPromptDialog( 438 bool ok = webframe->client()->runModalPromptDialog(message, defaultValue , &actualValue);
445 message,
446 defaultValue,
447 &actualValue);
448 if (ok) 439 if (ok)
449 result = actualValue; 440 result = actualValue;
450 return ok; 441 return ok;
451 } 442 }
452 return false; 443 return false;
453 } 444 }
454 445
455 void ChromeClientImpl::setStatusbarText(const String& message) 446 void ChromeClientImpl::setStatusbarText(const String& message)
456 { 447 {
457 if (m_webView->client()) 448 if (m_webView->client())
458 m_webView->client()->setStatusText(message); 449 m_webView->client()->setStatusText(message);
459 } 450 }
460 451
461 bool ChromeClientImpl::tabsToLinks() 452 bool ChromeClientImpl::tabsToLinks()
462 { 453 {
463 return m_webView->tabsToLinks(); 454 return m_webView->tabsToLinks();
464 } 455 }
465 456
466 IntRect ChromeClientImpl::windowResizerRect() const 457 IntRect ChromeClientImpl::windowResizerRect() const
467 { 458 {
468 IntRect result;
469 if (m_webView->client()) 459 if (m_webView->client())
470 result = m_webView->client()->windowResizerRect(); 460 return m_webView->client()->windowResizerRect();
471 return result; 461 return IntRect();
472 } 462 }
473 463
474 void ChromeClientImpl::invalidateRect(const IntRect& updateRect) 464 void ChromeClientImpl::invalidateRect(const IntRect& updateRect)
475 { 465 {
476 if (updateRect.isEmpty()) 466 if (!updateRect.isEmpty())
477 return; 467 m_webView->invalidateRect(updateRect);
478 m_webView->invalidateRect(updateRect);
479 } 468 }
480 469
481 void ChromeClientImpl::scheduleAnimation() 470 void ChromeClientImpl::scheduleAnimation()
482 { 471 {
483 m_webView->scheduleAnimation(); 472 m_webView->scheduleAnimation();
484 } 473 }
485 474
486 void ChromeClientImpl::scheduleAnimationForFrame(LocalFrame* localRoot) 475 void ChromeClientImpl::scheduleAnimationForFrame(LocalFrame* localRoot)
487 { 476 {
488 ASSERT(WebLocalFrameImpl::fromFrame(localRoot)); 477 ASSERT(WebLocalFrameImpl::fromFrame(localRoot));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 WebFileChooserParams params; 599 WebFileChooserParams params;
611 params.multiSelect = fileChooser->settings().allowsMultipleFiles; 600 params.multiSelect = fileChooser->settings().allowsMultipleFiles;
612 params.directory = fileChooser->settings().allowsDirectoryUpload; 601 params.directory = fileChooser->settings().allowsDirectoryUpload;
613 params.acceptTypes = fileChooser->settings().acceptTypes(); 602 params.acceptTypes = fileChooser->settings().acceptTypes();
614 params.selectedFiles = fileChooser->settings().selectedFiles; 603 params.selectedFiles = fileChooser->settings().selectedFiles;
615 if (params.selectedFiles.size() > 0) 604 if (params.selectedFiles.size() > 0)
616 params.initialValue = params.selectedFiles[0]; 605 params.initialValue = params.selectedFiles[0];
617 params.useMediaCapture = fileChooser->settings().useMediaCapture; 606 params.useMediaCapture = fileChooser->settings().useMediaCapture;
618 params.needLocalPath = fileChooser->settings().allowsDirectoryUpload; 607 params.needLocalPath = fileChooser->settings().allowsDirectoryUpload;
619 608
620 WebFileChooserCompletionImpl* chooserCompletion = 609 WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompleti onImpl(fileChooser);
621 new WebFileChooserCompletionImpl(fileChooser);
622
623 if (client->runFileChooser(params, chooserCompletion)) 610 if (client->runFileChooser(params, chooserCompletion))
624 return; 611 return;
625
626 // Choosing failed, so do callback with an empty list. 612 // Choosing failed, so do callback with an empty list.
627 chooserCompletion->didChooseFile(WebVector<WebString>()); 613 chooserCompletion->didChooseFile(WebVector<WebString>());
628 } 614 }
629 615
630 void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser) 616 void ChromeClientImpl::enumerateChosenDirectory(FileChooser* fileChooser)
631 { 617 {
632 WebViewClient* client = m_webView->client(); 618 WebViewClient* client = m_webView->client();
633 if (!client) 619 if (!client)
634 return; 620 return;
635 621
636 WebFileChooserCompletionImpl* chooserCompletion = 622 WebFileChooserCompletionImpl* chooserCompletion = new WebFileChooserCompleti onImpl(fileChooser);
637 new WebFileChooserCompletionImpl(fileChooser);
638 623
639 ASSERT(fileChooser && fileChooser->settings().selectedFiles.size()); 624 ASSERT(fileChooser);
625 ASSERT(fileChooser->settings().selectedFiles.size());
640 626
641 // If the enumeration can't happen, call the callback with an empty list. 627 // If the enumeration can't happen, call the callback with an empty list.
642 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[ 0], chooserCompletion)) 628 if (!client->enumerateChosenDirectory(fileChooser->settings().selectedFiles[ 0], chooserCompletion))
643 chooserCompletion->didChooseFile(WebVector<WebString>()); 629 chooserCompletion->didChooseFile(WebVector<WebString>());
644 } 630 }
645 631
646 void ChromeClientImpl::setCursorInternal(const Cursor& cursor) 632 void ChromeClientImpl::setCursorInternal(const Cursor& cursor)
647 { 633 {
648 setCursor(WebCursorInfo(cursor)); 634 setCursor(WebCursorInfo(cursor));
649 } 635 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return m_webView->client()->acceptLanguages(); 671 return m_webView->client()->acceptLanguages();
686 } 672 }
687 673
688 GraphicsLayerFactory* ChromeClientImpl::graphicsLayerFactory() const 674 GraphicsLayerFactory* ChromeClientImpl::graphicsLayerFactory() const
689 { 675 {
690 return m_webView->graphicsLayerFactory(); 676 return m_webView->graphicsLayerFactory();
691 } 677 }
692 678
693 void ChromeClientImpl::attachRootGraphicsLayer(GraphicsLayer* rootLayer, LocalFr ame* localRoot) 679 void ChromeClientImpl::attachRootGraphicsLayer(GraphicsLayer* rootLayer, LocalFr ame* localRoot)
694 { 680 {
695 // FIXME: For top-level frames we still use the WebView as a WebWidget. This special 681 // FIXME: For top-level frames we still use the WebView as a WebWidget. This
696 // case will be removed when top-level frames get WebFrameWidgets. 682 // special case will be removed when top-level frames get WebFrameWidgets.
697 if (localRoot->isMainFrame()) { 683 if (localRoot->isMainFrame()) {
698 m_webView->setRootGraphicsLayer(rootLayer); 684 m_webView->setRootGraphicsLayer(rootLayer);
699 } else { 685 } else {
700 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 686 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
701 // FIXME: The following conditional is only needed for staging until the Chromium patch 687 // FIXME: The following conditional is only needed for staging until the
702 // lands that instantiates a WebFrameWidget. 688 // Chromium patch lands that instantiates a WebFrameWidget.
703 if (!webFrame->frameWidget()) { 689 if (!webFrame->frameWidget()) {
704 m_webView->setRootGraphicsLayer(rootLayer); 690 m_webView->setRootGraphicsLayer(rootLayer);
705 return; 691 return;
706 } 692 }
707 ASSERT(webFrame && webFrame->frameWidget()); 693 ASSERT(webFrame);
694 ASSERT(webFrame->frameWidget());
708 webFrame->frameWidget()->setRootGraphicsLayer(rootLayer); 695 webFrame->frameWidget()->setRootGraphicsLayer(rootLayer);
709 } 696 }
710 } 697 }
711 698
712 void ChromeClientImpl::attachCompositorAnimationTimeline(WebCompositorAnimationT imeline* compositorTimeline, LocalFrame* localRoot) 699 void ChromeClientImpl::attachCompositorAnimationTimeline(WebCompositorAnimationT imeline* compositorTimeline, LocalFrame* localRoot)
713 { 700 {
714 // FIXME: For top-level frames we still use the WebView as a WebWidget. This special 701 // FIXME: For top-level frames we still use the WebView as a WebWidget. This
715 // case will be removed when top-level frames get WebFrameWidgets. 702 // special case will be removed when top-level frames get WebFrameWidgets.
716 if (localRoot->isMainFrame()) { 703 if (localRoot->isMainFrame()) {
717 m_webView->attachCompositorAnimationTimeline(compositorTimeline); 704 m_webView->attachCompositorAnimationTimeline(compositorTimeline);
718 } else { 705 } else {
719 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 706 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
720 // FIXME: The following conditional is only needed for staging until the Chromium patch 707 // FIXME: The following conditional is only needed for staging until the
721 // lands that instantiates a WebFrameWidget. 708 // Chromium patch lands that instantiates a WebFrameWidget.
722 if (!webFrame->frameWidget()) { 709 if (!webFrame->frameWidget()) {
723 m_webView->attachCompositorAnimationTimeline(compositorTimeline); 710 m_webView->attachCompositorAnimationTimeline(compositorTimeline);
724 return; 711 return;
725 } 712 }
726 ASSERT(webFrame && webFrame->frameWidget()); 713 ASSERT(webFrame);
714 ASSERT(webFrame->frameWidget());
727 webFrame->frameWidget()->attachCompositorAnimationTimeline(compositorTim eline); 715 webFrame->frameWidget()->attachCompositorAnimationTimeline(compositorTim eline);
728 } 716 }
729 } 717 }
730 718
731 void ChromeClientImpl::detachCompositorAnimationTimeline(WebCompositorAnimationT imeline* compositorTimeline, LocalFrame* localRoot) 719 void ChromeClientImpl::detachCompositorAnimationTimeline(WebCompositorAnimationT imeline* compositorTimeline, LocalFrame* localRoot)
732 { 720 {
733 // FIXME: For top-level frames we still use the WebView as a WebWidget. This special 721 // FIXME: For top-level frames we still use the WebView as a WebWidget. This
734 // case will be removed when top-level frames get WebFrameWidgets. 722 // special case will be removed when top-level frames get WebFrameWidgets.
735 if (localRoot->isMainFrame()) { 723 if (localRoot->isMainFrame()) {
736 m_webView->detachCompositorAnimationTimeline(compositorTimeline); 724 m_webView->detachCompositorAnimationTimeline(compositorTimeline);
737 } else { 725 } else {
738 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot); 726 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(localRoot);
739 // FIXME: The following conditional is only needed for staging until the Chromium patch 727 // FIXME: The following conditional is only needed for staging until the
740 // lands that instantiates a WebFrameWidget. 728 // Chromium patch lands that instantiates a WebFrameWidget.
741 if (!webFrame->frameWidget()) { 729 if (!webFrame->frameWidget()) {
742 m_webView->detachCompositorAnimationTimeline(compositorTimeline); 730 m_webView->detachCompositorAnimationTimeline(compositorTimeline);
743 return; 731 return;
744 } 732 }
745 ASSERT(webFrame && webFrame->frameWidget()); 733 ASSERT(webFrame);
734 ASSERT(webFrame->frameWidget());
746 webFrame->frameWidget()->detachCompositorAnimationTimeline(compositorTim eline); 735 webFrame->frameWidget()->detachCompositorAnimationTimeline(compositorTim eline);
747 } 736 }
748 } 737 }
749 738
750 void ChromeClientImpl::enterFullScreenForElement(Element* element) 739 void ChromeClientImpl::enterFullScreenForElement(Element* element)
751 { 740 {
752 m_webView->enterFullScreenForElement(element); 741 m_webView->enterFullScreenForElement(element);
753 } 742 }
754 743
755 void ChromeClientImpl::exitFullScreenForElement(Element* element) 744 void ChromeClientImpl::exitFullScreenForElement(Element* element)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 785
797 DOMWindow* ChromeClientImpl::pagePopupWindowForTesting() const 786 DOMWindow* ChromeClientImpl::pagePopupWindowForTesting() const
798 { 787 {
799 return m_webView->pagePopupWindow(); 788 return m_webView->pagePopupWindow();
800 } 789 }
801 790
802 bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, Document::PageDismissalType dismissalT ype) const 791 bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, Document::PageDismissalType dismissalT ype) const
803 { 792 {
804 const char* kDialogs[] = {"alert", "confirm", "prompt"}; 793 const char* kDialogs[] = {"alert", "confirm", "prompt"};
805 int dialog = static_cast<int>(dialogType); 794 int dialog = static_cast<int>(dialogType);
806 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dialog && dialog < static_cast<int>(ar raysize(kDialogs))); 795 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dialog);
796 ASSERT_WITH_SECURITY_IMPLICATION(dialog < static_cast<int>(arraysize(kDialog s)));
807 797
808 const char* kDismissals[] = {"beforeunload", "pagehide", "unload"}; 798 const char* kDismissals[] = {"beforeunload", "pagehide", "unload"};
809 int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal. 799 int dismissal = static_cast<int>(dismissalType) - 1; // Exclude NoDismissal.
810 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal && dismissal < static_cast<i nt>(arraysize(kDismissals))); 800 ASSERT_WITH_SECURITY_IMPLICATION(0 <= dismissal);
801 ASSERT_WITH_SECURITY_IMPLICATION(dismissal < static_cast<int>(arraysize(kDis missals)));
811 802
812 Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDi smissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arrays ize(kDismissals)); 803 Platform::current()->histogramEnumeration("Renderer.ModalDialogsDuringPageDi smissal", dismissal * arraysize(kDialogs) + dialog, arraysize(kDialogs) * arrays ize(kDismissals));
813 804
814 String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessag e + "') during " + kDismissals[dismissal] + "."; 805 String message = String("Blocked ") + kDialogs[dialog] + "('" + dialogMessag e + "') during " + kDismissals[dismissal] + ".";
815 m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMess age::LevelError, message)); 806 m_webView->mainFrame()->addMessageToConsole(WebConsoleMessage(WebConsoleMess age::LevelError, message));
816 807
817 return false; 808 return false;
818 } 809 }
819 810
820 void ChromeClientImpl::needTouchEvents(bool needsTouchEvents) 811 void ChromeClientImpl::needTouchEvents(bool needsTouchEvents)
821 { 812 {
822 m_webView->hasTouchEventHandlers(needsTouchEvents); 813 m_webView->hasTouchEventHandlers(needsTouchEvents);
823 } 814 }
824 815
825 void ChromeClientImpl::setTouchAction(TouchAction touchAction) 816 void ChromeClientImpl::setTouchAction(TouchAction touchAction)
826 { 817 {
827 if (WebViewClient* client = m_webView->client()) { 818 if (WebViewClient* client = m_webView->client())
828 WebTouchAction webTouchAction = static_cast<WebTouchAction>(touchAction) ; 819 client->setTouchAction(static_cast<WebTouchAction>(touchAction));
829 client->setTouchAction(webTouchAction);
830 }
831 } 820 }
832 821
833 bool ChromeClientImpl::requestPointerLock() 822 bool ChromeClientImpl::requestPointerLock()
834 { 823 {
835 return m_webView->requestPointerLock(); 824 return m_webView->requestPointerLock();
836 } 825 }
837 826
838 void ChromeClientImpl::requestPointerUnlock() 827 void ChromeClientImpl::requestPointerUnlock()
839 { 828 {
840 return m_webView->requestPointerUnlock(); 829 return m_webView->requestPointerUnlock();
841 } 830 }
842 831
843 void ChromeClientImpl::annotatedRegionsChanged() 832 void ChromeClientImpl::annotatedRegionsChanged()
844 { 833 {
845 WebViewClient* client = m_webView->client(); 834 if (WebViewClient* client = m_webView->client())
846 if (client)
847 client->draggableRegionsChanged(); 835 client->draggableRegionsChanged();
848 } 836 }
849 837
850 void ChromeClientImpl::didAssociateFormControls(const WillBeHeapVector<RefPtrWil lBeMember<Element>>& elements, LocalFrame* frame) 838 void ChromeClientImpl::didAssociateFormControls(const WillBeHeapVector<RefPtrWil lBeMember<Element>>& elements, LocalFrame* frame)
851 { 839 {
852 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame); 840 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(frame);
853 if (webframe->autofillClient()) 841 if (webframe->autofillClient())
854 webframe->autofillClient()->didAssociateFormControls(elements); 842 webframe->autofillClient()->didAssociateFormControls(elements);
855 } 843 }
856 844
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 void ChromeClientImpl::unregisterPopupOpeningObserver(PopupOpeningObserver* obse rver) 935 void ChromeClientImpl::unregisterPopupOpeningObserver(PopupOpeningObserver* obse rver)
948 { 936 {
949 size_t index = m_popupOpeningObservers.find(observer); 937 size_t index = m_popupOpeningObservers.find(observer);
950 ASSERT(index != kNotFound); 938 ASSERT(index != kNotFound);
951 m_popupOpeningObservers.remove(index); 939 m_popupOpeningObservers.remove(index);
952 } 940 }
953 941
954 void ChromeClientImpl::notifyPopupOpeningObservers() const 942 void ChromeClientImpl::notifyPopupOpeningObservers() const
955 { 943 {
956 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); 944 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers);
957 for (size_t i = 0; i < observers.size(); ++i) 945 for (const auto& observer : observers)
958 observers[i]->willOpenPopup(); 946 observer->willOpenPopup();
959 } 947 }
960 948
961 } // namespace blink 949 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698