| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 WebColor color_; | 264 WebColor color_; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 } // namespace | 267 } // namespace |
| 268 | 268 |
| 269 // WebView ---------------------------------------------------------------- | 269 // WebView ---------------------------------------------------------------- |
| 270 | 270 |
| 271 WebView* WebView::Create(WebViewClient* client, | 271 WebView* WebView::Create(WebViewClient* client, |
| 272 WebPageVisibilityState visibility_state) { | 272 WebPageVisibilityState visibility_state, |
| 273 return WebViewImpl::Create(client, visibility_state); | 273 WebView* opener) { |
| 274 return WebViewImpl::Create(client, visibility_state, |
| 275 static_cast<WebViewImpl*>(opener)); |
| 274 } | 276 } |
| 275 | 277 |
| 276 WebViewBase* WebViewImpl::Create(WebViewClient* client, | 278 WebViewBase* WebViewImpl::Create(WebViewClient* client, |
| 277 WebPageVisibilityState visibility_state) { | 279 WebPageVisibilityState visibility_state, |
| 280 WebViewImpl* opener) { |
| 278 // Pass the WebViewImpl's self-reference to the caller. | 281 // Pass the WebViewImpl's self-reference to the caller. |
| 279 return AdoptRef(new WebViewImpl(client, visibility_state)).LeakRef(); | 282 return AdoptRef(new WebViewImpl(client, visibility_state, opener)).LeakRef(); |
| 280 } | 283 } |
| 281 | 284 |
| 282 const WebInputEvent* WebViewBase::CurrentInputEvent() { | 285 const WebInputEvent* WebViewBase::CurrentInputEvent() { |
| 283 return WebViewImpl::CurrentInputEvent(); | 286 return WebViewImpl::CurrentInputEvent(); |
| 284 } | 287 } |
| 285 | 288 |
| 286 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { | 289 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { |
| 287 g_should_use_external_popup_menus = use_external_popup_menus; | 290 g_should_use_external_popup_menus = use_external_popup_menus; |
| 288 } | 291 } |
| 289 | 292 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 spell_check_client_ = spell_check_client; | 329 spell_check_client_ = spell_check_client; |
| 327 } | 330 } |
| 328 | 331 |
| 329 // static | 332 // static |
| 330 HashSet<WebViewBase*>& WebViewBase::AllInstances() { | 333 HashSet<WebViewBase*>& WebViewBase::AllInstances() { |
| 331 DEFINE_STATIC_LOCAL(HashSet<WebViewBase*>, all_instances, ()); | 334 DEFINE_STATIC_LOCAL(HashSet<WebViewBase*>, all_instances, ()); |
| 332 return all_instances; | 335 return all_instances; |
| 333 } | 336 } |
| 334 | 337 |
| 335 WebViewImpl::WebViewImpl(WebViewClient* client, | 338 WebViewImpl::WebViewImpl(WebViewClient* client, |
| 336 WebPageVisibilityState visibility_state) | 339 WebPageVisibilityState visibility_state, |
| 340 WebViewImpl* opener) |
| 337 : client_(client), | 341 : client_(client), |
| 338 spell_check_client_(nullptr), | 342 spell_check_client_(nullptr), |
| 339 chrome_client_(WebFactory::GetInstance().CreateChromeClient(this)), | 343 chrome_client_(WebFactory::GetInstance().CreateChromeClient(this)), |
| 340 context_menu_client_impl_(this), | 344 context_menu_client_impl_(this), |
| 341 editor_client_impl_(this), | 345 editor_client_impl_(this), |
| 342 spell_checker_client_impl_(this), | 346 spell_checker_client_impl_(this), |
| 343 storage_client_impl_(this), | 347 storage_client_impl_(this), |
| 344 should_auto_resize_(false), | 348 should_auto_resize_(false), |
| 345 zoom_level_(0), | 349 zoom_level_(0), |
| 346 minimum_zoom_level_(ZoomFactorToZoomLevel(kMinTextSizeMultiplier)), | 350 minimum_zoom_level_(ZoomFactorToZoomLevel(kMinTextSizeMultiplier)), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ->CreateWebViewScheduler(this, this) | 387 ->CreateWebViewScheduler(this, this) |
| 384 .release())), | 388 .release())), |
| 385 last_frame_time_monotonic_(0), | 389 last_frame_time_monotonic_(0), |
| 386 override_compositor_visibility_(false) { | 390 override_compositor_visibility_(false) { |
| 387 Page::PageClients page_clients; | 391 Page::PageClients page_clients; |
| 388 page_clients.chrome_client = chrome_client_.Get(); | 392 page_clients.chrome_client = chrome_client_.Get(); |
| 389 page_clients.context_menu_client = &context_menu_client_impl_; | 393 page_clients.context_menu_client = &context_menu_client_impl_; |
| 390 page_clients.editor_client = &editor_client_impl_; | 394 page_clients.editor_client = &editor_client_impl_; |
| 391 page_clients.spell_checker_client = &spell_checker_client_impl_; | 395 page_clients.spell_checker_client = &spell_checker_client_impl_; |
| 392 | 396 |
| 393 page_ = Page::CreateOrdinary(page_clients); | 397 page_ = |
| 398 Page::CreateOrdinary(page_clients, opener ? opener->GetPage() : nullptr); |
| 394 MediaKeysController::ProvideMediaKeysTo(*page_, &media_keys_client_impl_); | 399 MediaKeysController::ProvideMediaKeysTo(*page_, &media_keys_client_impl_); |
| 395 ProvideSpeechRecognitionTo( | 400 ProvideSpeechRecognitionTo( |
| 396 *page_, SpeechRecognitionClientProxy::Create( | 401 *page_, SpeechRecognitionClientProxy::Create( |
| 397 client ? client->SpeechRecognizer() : nullptr)); | 402 client ? client->SpeechRecognizer() : nullptr)); |
| 398 ProvideContextFeaturesTo(*page_, ContextFeaturesClientImpl::Create()); | 403 ProvideContextFeaturesTo(*page_, ContextFeaturesClientImpl::Create()); |
| 399 ProvideDatabaseClientTo(*page_, new DatabaseClient); | 404 ProvideDatabaseClientTo(*page_, new DatabaseClient); |
| 400 | 405 |
| 401 ProvideStorageQuotaClientTo(*page_, StorageQuotaClientImpl::Create()); | 406 ProvideStorageQuotaClientTo(*page_, StorageQuotaClientImpl::Create()); |
| 402 page_->SetValidationMessageClient(ValidationMessageClientImpl::Create(*this)); | 407 page_->SetValidationMessageClient(ValidationMessageClientImpl::Create(*this)); |
| 403 ProvideDedicatedWorkerMessagingProxyProviderTo( | 408 ProvideDedicatedWorkerMessagingProxyProviderTo( |
| (...skipping 3733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4137 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4142 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4138 return nullptr; | 4143 return nullptr; |
| 4139 return focused_frame; | 4144 return focused_frame; |
| 4140 } | 4145 } |
| 4141 | 4146 |
| 4142 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4147 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4143 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4148 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4144 } | 4149 } |
| 4145 | 4150 |
| 4146 } // namespace blink | 4151 } // namespace blink |
| OLD | NEW |