| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |     2  * Copyright (C) 2011, 2012 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 |     5  * modification, are permitted provided that the following conditions are | 
|     6  * met: |     6  * met: | 
|     7  * |     7  * | 
|     8  *     * Redistributions of source code must retain the above copyright |     8  *     * Redistributions of source code must retain the above copyright | 
|     9  * notice, this list of conditions and the following disclaimer. |     9  * notice, this list of conditions and the following disclaimer. | 
|    10  *     * Redistributions in binary form must reproduce the above |    10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   328         graphicsContext.fillRect(rect, m_color); |   328         graphicsContext.fillRect(rect, m_color); | 
|   329     } |   329     } | 
|   330  |   330  | 
|   331     WebColor m_color; |   331     WebColor m_color; | 
|   332 }; |   332 }; | 
|   333  |   333  | 
|   334 } // namespace |   334 } // namespace | 
|   335  |   335  | 
|   336 // WebView ---------------------------------------------------------------- |   336 // WebView ---------------------------------------------------------------- | 
|   337  |   337  | 
|   338 WebView* WebView::create(WebViewClient* client) |   338 WebView* WebView::create(WebViewClient* client, WebPageVisibilityState visibilit
      yState) | 
|   339 { |   339 { | 
|   340     // Pass the WebViewImpl's self-reference to the caller. |   340     // Pass the WebViewImpl's self-reference to the caller. | 
|   341     return WebViewImpl::create(client); |   341     return WebViewImpl::create(client, visibilityState); | 
|   342 } |   342 } | 
|   343  |   343  | 
|   344 WebViewImpl* WebViewImpl::create(WebViewClient* client) |   344 WebViewImpl* WebViewImpl::create(WebViewClient* client, WebPageVisibilityState v
      isibilityState) | 
|   345 { |   345 { | 
|   346     // Pass the WebViewImpl's self-reference to the caller. |   346     // Pass the WebViewImpl's self-reference to the caller. | 
|   347     return adoptRef(new WebViewImpl(client)).leakRef(); |   347     return adoptRef(new WebViewImpl(client, visibilityState)).leakRef(); | 
|   348 } |   348 } | 
|   349  |   349  | 
|   350 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) |   350 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) | 
|   351 { |   351 { | 
|   352     shouldUseExternalPopupMenus = useExternalPopupMenus; |   352     shouldUseExternalPopupMenus = useExternalPopupMenus; | 
|   353 } |   353 } | 
|   354  |   354  | 
|   355 void WebView::updateVisitedLinkState(unsigned long long linkHash) |   355 void WebView::updateVisitedLinkState(unsigned long long linkHash) | 
|   356 { |   356 { | 
|   357     Page::visitedStateChanged(linkHash); |   357     Page::visitedStateChanged(linkHash); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   395     m_spellCheckClient = spellCheckClient; |   395     m_spellCheckClient = spellCheckClient; | 
|   396 } |   396 } | 
|   397  |   397  | 
|   398 // static |   398 // static | 
|   399 HashSet<WebViewImpl*>& WebViewImpl::allInstances() |   399 HashSet<WebViewImpl*>& WebViewImpl::allInstances() | 
|   400 { |   400 { | 
|   401     DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); |   401     DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); | 
|   402     return allInstances; |   402     return allInstances; | 
|   403 } |   403 } | 
|   404  |   404  | 
|   405 WebViewImpl::WebViewImpl(WebViewClient* client) |   405 WebViewImpl::WebViewImpl(WebViewClient* client, WebPageVisibilityState visibilit
      yState) | 
|   406     : m_client(client) |   406     : m_client(client) | 
|   407     , m_spellCheckClient(nullptr) |   407     , m_spellCheckClient(nullptr) | 
|   408     , m_chromeClientImpl(ChromeClientImpl::create(this)) |   408     , m_chromeClientImpl(ChromeClientImpl::create(this)) | 
|   409     , m_contextMenuClientImpl(this) |   409     , m_contextMenuClientImpl(this) | 
|   410     , m_editorClientImpl(this) |   410     , m_editorClientImpl(this) | 
|   411     , m_spellCheckerClientImpl(this) |   411     , m_spellCheckerClientImpl(this) | 
|   412     , m_storageClientImpl(this) |   412     , m_storageClientImpl(this) | 
|   413     , m_shouldAutoResize(false) |   413     , m_shouldAutoResize(false) | 
|   414     , m_zoomLevel(0) |   414     , m_zoomLevel(0) | 
|   415     , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |   415     , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
|   445     , m_zoomFactorOverride(0) |   445     , m_zoomFactorOverride(0) | 
|   446     , m_userGestureObserved(false) |   446     , m_userGestureObserved(false) | 
|   447     , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) |   447     , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) | 
|   448     , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) |   448     , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) | 
|   449     , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) |   449     , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) | 
|   450     , m_displayMode(WebDisplayModeBrowser) |   450     , m_displayMode(WebDisplayModeBrowser) | 
|   451     , m_elasticOverscroll(FloatSize()) |   451     , m_elasticOverscroll(FloatSize()) | 
|   452     , m_mutator(nullptr) |   452     , m_mutator(nullptr) | 
|   453     , m_scheduler(wrapUnique(Platform::current()->currentThread()->scheduler()->
      createWebViewScheduler(this).release())) |   453     , m_scheduler(wrapUnique(Platform::current()->currentThread()->scheduler()->
      createWebViewScheduler(this).release())) | 
|   454     , m_lastFrameTimeMonotonic(0) |   454     , m_lastFrameTimeMonotonic(0) | 
 |   455     , m_overrideCompositorVisibility(false) | 
|   455 { |   456 { | 
|   456     Page::PageClients pageClients; |   457     Page::PageClients pageClients; | 
|   457     pageClients.chromeClient = m_chromeClientImpl.get(); |   458     pageClients.chromeClient = m_chromeClientImpl.get(); | 
|   458     pageClients.contextMenuClient = &m_contextMenuClientImpl; |   459     pageClients.contextMenuClient = &m_contextMenuClientImpl; | 
|   459     pageClients.editorClient = &m_editorClientImpl; |   460     pageClients.editorClient = &m_editorClientImpl; | 
|   460     pageClients.spellCheckerClient = &m_spellCheckerClientImpl; |   461     pageClients.spellCheckerClient = &m_spellCheckerClientImpl; | 
|   461  |   462  | 
|   462     m_page = Page::createOrdinary(pageClients); |   463     m_page = Page::createOrdinary(pageClients); | 
|   463     MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); |   464     MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); | 
|   464     provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
      ent ? client->speechRecognizer() : nullptr)); |   465     provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
      ent ? client->speechRecognizer() : nullptr)); | 
|   465     provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); |   466     provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); | 
|   466     provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); |   467     provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); | 
|   467  |   468  | 
|   468     provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); |   469     provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); | 
|   469     m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
      )); |   470     m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
      )); | 
|   470     provideDedicatedWorkerGlobalScopeProxyProviderTo(*m_page, DedicatedWorkerGlo
      balScopeProxyProviderImpl::create()); |   471     provideDedicatedWorkerGlobalScopeProxyProviderTo(*m_page, DedicatedWorkerGlo
      balScopeProxyProviderImpl::create()); | 
|   471     StorageNamespaceController::provideStorageNamespaceTo(*m_page, &m_storageCli
      entImpl); |   472     StorageNamespaceController::provideStorageNamespaceTo(*m_page, &m_storageCli
      entImpl); | 
|   472  |   473  | 
|   473     if (m_client) { |   474     setVisibilityState(visibilityState, true); | 
|   474         setVisibilityState(m_client->visibilityState(), true); |  | 
|   475     } |  | 
|   476  |   475  | 
|   477     initializeLayerTreeView(); |   476     initializeLayerTreeView(); | 
|   478  |   477  | 
|   479     m_devToolsEmulator = DevToolsEmulator::create(this); |   478     m_devToolsEmulator = DevToolsEmulator::create(this); | 
|   480  |   479  | 
|   481     allInstances().add(this); |   480     allInstances().add(this); | 
|   482  |   481  | 
|   483     m_pageImportanceSignals.setObserver(client); |   482     m_pageImportanceSignals.setObserver(client); | 
|   484 } |   483 } | 
|   485  |   484  | 
| (...skipping 3929 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4415 } |  4414 } | 
|  4416  |  4415  | 
|  4417 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, |  4416 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, | 
|  4418                                      bool isInitialState) { |  4417                                      bool isInitialState) { | 
|  4419     DCHECK(visibilityState == WebPageVisibilityStateVisible || visibilityState =
      = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere
      nder); |  4418     DCHECK(visibilityState == WebPageVisibilityStateVisible || visibilityState =
      = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere
      nder); | 
|  4420  |  4419  | 
|  4421     if (page()) |  4420     if (page()) | 
|  4422         m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<
      int>(visibilityState)), isInitialState); |  4421         m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<
      int>(visibilityState)), isInitialState); | 
|  4423  |  4422  | 
|  4424     bool visible = visibilityState == WebPageVisibilityStateVisible; |  4423     bool visible = visibilityState == WebPageVisibilityStateVisible; | 
|  4425     if (m_layerTreeView) |  4424     if (m_layerTreeView && !m_overrideCompositorVisibility) | 
|  4426         m_layerTreeView->setVisible(visible); |  4425         m_layerTreeView->setVisible(visible); | 
|  4427     m_scheduler->setPageVisible(visible); |  4426     m_scheduler->setPageVisible(visible); | 
|  4428 } |  4427 } | 
|  4429  |  4428  | 
 |  4429 void WebViewImpl::setCompositorVisibility(bool isVisible) | 
 |  4430 { | 
 |  4431     if (!isVisible) | 
 |  4432         m_overrideCompositorVisibility = true; | 
 |  4433     else | 
 |  4434         m_overrideCompositorVisibility = false; | 
 |  4435     if (m_layerTreeView) | 
 |  4436         m_layerTreeView->setVisible(isVisible); | 
 |  4437 } | 
 |  4438  | 
|  4430 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) |  4439 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) | 
|  4431 { |  4440 { | 
|  4432     std::unique_ptr<UserGestureIndicator> gestureIndicator; |  4441     std::unique_ptr<UserGestureIndicator> gestureIndicator; | 
|  4433     AtomicString eventType; |  4442     AtomicString eventType; | 
|  4434     switch (event.type) { |  4443     switch (event.type) { | 
|  4435     case WebInputEvent::MouseDown: |  4444     case WebInputEvent::MouseDown: | 
|  4436         eventType = EventTypeNames::mousedown; |  4445         eventType = EventTypeNames::mousedown; | 
|  4437         gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess
      ingNewUserGesture)); |  4446         gestureIndicator = wrapUnique(new UserGestureIndicator(DefinitelyProcess
      ingNewUserGesture)); | 
|  4438         m_pointerLockGestureToken = gestureIndicator->currentToken(); |  4447         m_pointerLockGestureToken = gestureIndicator->currentToken(); | 
|  4439         break; |  4448         break; | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4521 { |  4530 { | 
|  4522     // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
      ctor rather than |  4531     // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
      ctor rather than | 
|  4523     // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |  4532     // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 
|  4524     if (!page()) |  4533     if (!page()) | 
|  4525         return 1; |  4534         return 1; | 
|  4526  |  4535  | 
|  4527     return page()->deviceScaleFactor(); |  4536     return page()->deviceScaleFactor(); | 
|  4528 } |  4537 } | 
|  4529  |  4538  | 
|  4530 } // namespace blink |  4539 } // namespace blink | 
| OLD | NEW |