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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 graphicsContext.fillRect(rect, m_color); | 326 graphicsContext.fillRect(rect, m_color); |
327 } | 327 } |
328 | 328 |
329 WebColor m_color; | 329 WebColor m_color; |
330 }; | 330 }; |
331 | 331 |
332 } // namespace | 332 } // namespace |
333 | 333 |
334 // WebView ---------------------------------------------------------------- | 334 // WebView ---------------------------------------------------------------- |
335 | 335 |
336 WebView* WebView::create(WebViewClient* client) | 336 WebView* WebView::create(WebViewClient* client, bool isVisible) |
337 { | 337 { |
338 // Pass the WebViewImpl's self-reference to the caller. | 338 // Pass the WebViewImpl's self-reference to the caller. |
339 return WebViewImpl::create(client); | 339 return WebViewImpl::create(client, isVisible); |
340 } | 340 } |
341 | 341 |
342 WebViewImpl* WebViewImpl::create(WebViewClient* client) | 342 WebViewImpl* WebViewImpl::create(WebViewClient* client, bool isVisible) |
343 { | 343 { |
344 // Pass the WebViewImpl's self-reference to the caller. | 344 // Pass the WebViewImpl's self-reference to the caller. |
345 return adoptRef(new WebViewImpl(client)).leakRef(); | 345 return adoptRef(new WebViewImpl(client, isVisible)).leakRef(); |
346 } | 346 } |
347 | 347 |
348 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) | 348 void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus) |
349 { | 349 { |
350 shouldUseExternalPopupMenus = useExternalPopupMenus; | 350 shouldUseExternalPopupMenus = useExternalPopupMenus; |
351 } | 351 } |
352 | 352 |
353 void WebView::updateVisitedLinkState(unsigned long long linkHash) | 353 void WebView::updateVisitedLinkState(unsigned long long linkHash) |
354 { | 354 { |
355 Page::visitedStateChanged(linkHash); | 355 Page::visitedStateChanged(linkHash); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 m_spellCheckClient = spellCheckClient; | 393 m_spellCheckClient = spellCheckClient; |
394 } | 394 } |
395 | 395 |
396 // static | 396 // static |
397 HashSet<WebViewImpl*>& WebViewImpl::allInstances() | 397 HashSet<WebViewImpl*>& WebViewImpl::allInstances() |
398 { | 398 { |
399 DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); | 399 DEFINE_STATIC_LOCAL(HashSet<WebViewImpl*>, allInstances, ()); |
400 return allInstances; | 400 return allInstances; |
401 } | 401 } |
402 | 402 |
403 WebViewImpl::WebViewImpl(WebViewClient* client) | 403 WebViewImpl::WebViewImpl(WebViewClient* client, bool isVisible) |
404 : m_client(client) | 404 : m_client(client) |
405 , m_spellCheckClient(nullptr) | 405 , m_spellCheckClient(nullptr) |
406 , m_chromeClientImpl(ChromeClientImpl::create(this)) | 406 , m_chromeClientImpl(ChromeClientImpl::create(this)) |
407 , m_contextMenuClientImpl(this) | 407 , m_contextMenuClientImpl(this) |
408 , m_editorClientImpl(this) | 408 , m_editorClientImpl(this) |
409 , m_spellCheckerClientImpl(this) | 409 , m_spellCheckerClientImpl(this) |
410 , m_storageClientImpl(this) | 410 , m_storageClientImpl(this) |
411 , m_shouldAutoResize(false) | 411 , m_shouldAutoResize(false) |
412 , m_zoomLevel(0) | 412 , m_zoomLevel(0) |
413 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 413 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); | 461 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); |
462 provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
ent ? client->speechRecognizer() : nullptr)); | 462 provideSpeechRecognitionTo(*m_page, SpeechRecognitionClientProxy::create(cli
ent ? client->speechRecognizer() : nullptr)); |
463 provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); | 463 provideContextFeaturesTo(*m_page, ContextFeaturesClientImpl::create()); |
464 provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); | 464 provideDatabaseClientTo(*m_page, DatabaseClientImpl::create()); |
465 | 465 |
466 provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); | 466 provideStorageQuotaClientTo(*m_page, StorageQuotaClientImpl::create()); |
467 m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
)); | 467 m_page->setValidationMessageClient(ValidationMessageClientImpl::create(*this
)); |
468 provideDedicatedWorkerGlobalScopeProxyProviderTo(*m_page, DedicatedWorkerGlo
balScopeProxyProviderImpl::create()); | 468 provideDedicatedWorkerGlobalScopeProxyProviderTo(*m_page, DedicatedWorkerGlo
balScopeProxyProviderImpl::create()); |
469 StorageNamespaceController::provideStorageNamespaceTo(*m_page, &m_storageCli
entImpl); | 469 StorageNamespaceController::provideStorageNamespaceTo(*m_page, &m_storageCli
entImpl); |
470 | 470 |
471 if (m_client) { | 471 setVisibilityState(isVisible ? WebPageVisibilityStateVisible : WebPageVisibi
lityStateHidden, true); |
472 setVisibilityState(m_client->visibilityState(), true); | |
473 } | |
474 | 472 |
475 initializeLayerTreeView(); | 473 initializeLayerTreeView(); |
476 | 474 |
477 m_devToolsEmulator = DevToolsEmulator::create(this); | 475 m_devToolsEmulator = DevToolsEmulator::create(this); |
478 | 476 |
479 allInstances().add(this); | 477 allInstances().add(this); |
480 | 478 |
481 m_pageImportanceSignals.setObserver(client); | 479 m_pageImportanceSignals.setObserver(client); |
482 } | 480 } |
483 | 481 |
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4553 { | 4551 { |
4554 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than | 4552 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa
ctor rather than |
4555 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4553 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. |
4556 if (!page()) | 4554 if (!page()) |
4557 return 1; | 4555 return 1; |
4558 | 4556 |
4559 return page()->deviceScaleFactor(); | 4557 return page()->deviceScaleFactor(); |
4560 } | 4558 } |
4561 | 4559 |
4562 } // namespace blink | 4560 } // namespace blink |
OLD | NEW |