| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 graphics_context.FillRect(rect, color_); | 263 graphics_context.FillRect(rect, color_); |
| 264 } | 264 } |
| 265 | 265 |
| 266 WebColor color_; | 266 WebColor color_; |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 } // namespace | 269 } // namespace |
| 270 | 270 |
| 271 // WebView ---------------------------------------------------------------- | 271 // WebView ---------------------------------------------------------------- |
| 272 | 272 |
| 273 static_assert( |
| 274 Page::kUnknownBrowsingInstance == WebView::kUnknownBrowsingInstance, |
| 275 "Constants should have the same value in blink's web and core layers"); |
| 276 |
| 273 WebView* WebView::Create(WebViewClient* client, | 277 WebView* WebView::Create(WebViewClient* client, |
| 274 WebPageVisibilityState visibility_state) { | 278 WebPageVisibilityState visibility_state, |
| 275 return WebViewImpl::Create(client, visibility_state); | 279 int browsing_instance_id) { |
| 280 return WebViewImpl::Create(client, visibility_state, browsing_instance_id); |
| 276 } | 281 } |
| 277 | 282 |
| 278 WebViewBase* WebViewImpl::Create(WebViewClient* client, | 283 WebViewBase* WebViewImpl::Create(WebViewClient* client, |
| 279 WebPageVisibilityState visibility_state) { | 284 WebPageVisibilityState visibility_state, |
| 285 int browsing_instance_id) { |
| 280 // Pass the WebViewImpl's self-reference to the caller. | 286 // Pass the WebViewImpl's self-reference to the caller. |
| 281 return AdoptRef(new WebViewImpl(client, visibility_state)).LeakRef(); | 287 return AdoptRef( |
| 288 new WebViewImpl(client, visibility_state, browsing_instance_id)) |
| 289 .LeakRef(); |
| 282 } | 290 } |
| 283 | 291 |
| 284 const WebInputEvent* WebViewBase::CurrentInputEvent() { | 292 const WebInputEvent* WebViewBase::CurrentInputEvent() { |
| 285 return WebViewImpl::CurrentInputEvent(); | 293 return WebViewImpl::CurrentInputEvent(); |
| 286 } | 294 } |
| 287 | 295 |
| 288 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { | 296 void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { |
| 289 g_should_use_external_popup_menus = use_external_popup_menus; | 297 g_should_use_external_popup_menus = use_external_popup_menus; |
| 290 } | 298 } |
| 291 | 299 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 spell_check_client_ = spell_check_client; | 336 spell_check_client_ = spell_check_client; |
| 329 } | 337 } |
| 330 | 338 |
| 331 // static | 339 // static |
| 332 HashSet<WebViewBase*>& WebViewBase::AllInstances() { | 340 HashSet<WebViewBase*>& WebViewBase::AllInstances() { |
| 333 DEFINE_STATIC_LOCAL(HashSet<WebViewBase*>, all_instances, ()); | 341 DEFINE_STATIC_LOCAL(HashSet<WebViewBase*>, all_instances, ()); |
| 334 return all_instances; | 342 return all_instances; |
| 335 } | 343 } |
| 336 | 344 |
| 337 WebViewImpl::WebViewImpl(WebViewClient* client, | 345 WebViewImpl::WebViewImpl(WebViewClient* client, |
| 338 WebPageVisibilityState visibility_state) | 346 WebPageVisibilityState visibility_state, |
| 347 int browsing_instance_id) |
| 339 : client_(client), | 348 : client_(client), |
| 340 spell_check_client_(nullptr), | 349 spell_check_client_(nullptr), |
| 341 chrome_client_impl_(ChromeClientImpl::Create(this)), | 350 chrome_client_impl_(ChromeClientImpl::Create(this)), |
| 342 context_menu_client_impl_(this), | 351 context_menu_client_impl_(this), |
| 343 editor_client_impl_(this), | 352 editor_client_impl_(this), |
| 344 spell_checker_client_impl_(this), | 353 spell_checker_client_impl_(this), |
| 345 storage_client_impl_(this), | 354 storage_client_impl_(this), |
| 346 should_auto_resize_(false), | 355 should_auto_resize_(false), |
| 347 zoom_level_(0), | 356 zoom_level_(0), |
| 348 minimum_zoom_level_(ZoomFactorToZoomLevel(kMinTextSizeMultiplier)), | 357 minimum_zoom_level_(ZoomFactorToZoomLevel(kMinTextSizeMultiplier)), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 ->CreateWebViewScheduler(this, this) | 394 ->CreateWebViewScheduler(this, this) |
| 386 .release())), | 395 .release())), |
| 387 last_frame_time_monotonic_(0), | 396 last_frame_time_monotonic_(0), |
| 388 override_compositor_visibility_(false) { | 397 override_compositor_visibility_(false) { |
| 389 Page::PageClients page_clients; | 398 Page::PageClients page_clients; |
| 390 page_clients.chrome_client = chrome_client_impl_.Get(); | 399 page_clients.chrome_client = chrome_client_impl_.Get(); |
| 391 page_clients.context_menu_client = &context_menu_client_impl_; | 400 page_clients.context_menu_client = &context_menu_client_impl_; |
| 392 page_clients.editor_client = &editor_client_impl_; | 401 page_clients.editor_client = &editor_client_impl_; |
| 393 page_clients.spell_checker_client = &spell_checker_client_impl_; | 402 page_clients.spell_checker_client = &spell_checker_client_impl_; |
| 394 | 403 |
| 395 page_ = Page::CreateOrdinary(page_clients); | 404 page_ = Page::CreateOrdinary(page_clients, browsing_instance_id); |
| 396 MediaKeysController::ProvideMediaKeysTo(*page_, &media_keys_client_impl_); | 405 MediaKeysController::ProvideMediaKeysTo(*page_, &media_keys_client_impl_); |
| 397 ProvideSpeechRecognitionTo( | 406 ProvideSpeechRecognitionTo( |
| 398 *page_, SpeechRecognitionClientProxy::Create( | 407 *page_, SpeechRecognitionClientProxy::Create( |
| 399 client ? client->SpeechRecognizer() : nullptr)); | 408 client ? client->SpeechRecognizer() : nullptr)); |
| 400 ProvideContextFeaturesTo(*page_, ContextFeaturesClientImpl::Create()); | 409 ProvideContextFeaturesTo(*page_, ContextFeaturesClientImpl::Create()); |
| 401 ProvideDatabaseClientTo(*page_, new DatabaseClient); | 410 ProvideDatabaseClientTo(*page_, new DatabaseClient); |
| 402 | 411 |
| 403 ProvideStorageQuotaClientTo(*page_, StorageQuotaClientImpl::Create()); | 412 ProvideStorageQuotaClientTo(*page_, StorageQuotaClientImpl::Create()); |
| 404 page_->SetValidationMessageClient(ValidationMessageClientImpl::Create(*this)); | 413 page_->SetValidationMessageClient(ValidationMessageClientImpl::Create(*this)); |
| 405 ProvideDedicatedWorkerMessagingProxyProviderTo( | 414 ProvideDedicatedWorkerMessagingProxyProviderTo( |
| (...skipping 3763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4169 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4178 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4170 return nullptr; | 4179 return nullptr; |
| 4171 return focused_frame; | 4180 return focused_frame; |
| 4172 } | 4181 } |
| 4173 | 4182 |
| 4174 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4183 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4175 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4184 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4176 } | 4185 } |
| 4177 | 4186 |
| 4178 } // namespace blink | 4187 } // namespace blink |
| OLD | NEW |