OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/renderer_host/dip_util.h" | 10 #include "content/browser/renderer_host/dip_util.h" |
11 #include "content/browser/renderer_host/overscroll_controller.h" | 11 #include "content/browser/renderer_host/overscroll_controller.h" |
12 #include "content/browser/renderer_host/render_view_host_factory.h" | 12 #include "content/browser/renderer_host/render_view_host_factory.h" |
13 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
15 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
16 #include "content/browser/web_contents/aura/image_window_delegate.h" | 16 #include "content/browser/web_contents/aura/image_window_delegate.h" |
17 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" | 17 #include "content/browser/web_contents/aura/shadow_layer_delegate.h" |
| 18 #include "content/browser/web_contents/aura/window_slider.h" |
18 #include "content/browser/web_contents/interstitial_page_impl.h" | 19 #include "content/browser/web_contents/interstitial_page_impl.h" |
19 #include "content/browser/web_contents/navigation_entry_impl.h" | 20 #include "content/browser/web_contents/navigation_entry_impl.h" |
20 #include "content/browser/web_contents/touch_editable_impl_aura.h" | 21 #include "content/browser/web_contents/touch_editable_impl_aura.h" |
21 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
22 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
25 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
26 #include "content/public/browser/overscroll_configuration.h" | 27 #include "content/public/browser/overscroll_configuration.h" |
27 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 web_input_event_modifiers |= WebKit::WebInputEvent::ShiftKey; | 328 web_input_event_modifiers |= WebKit::WebInputEvent::ShiftKey; |
328 if (aura_event_flags & ui::EF_CONTROL_DOWN) | 329 if (aura_event_flags & ui::EF_CONTROL_DOWN) |
329 web_input_event_modifiers |= WebKit::WebInputEvent::ControlKey; | 330 web_input_event_modifiers |= WebKit::WebInputEvent::ControlKey; |
330 if (aura_event_flags & ui::EF_ALT_DOWN) | 331 if (aura_event_flags & ui::EF_ALT_DOWN) |
331 web_input_event_modifiers |= WebKit::WebInputEvent::AltKey; | 332 web_input_event_modifiers |= WebKit::WebInputEvent::AltKey; |
332 if (aura_event_flags & ui::EF_COMMAND_DOWN) | 333 if (aura_event_flags & ui::EF_COMMAND_DOWN) |
333 web_input_event_modifiers |= WebKit::WebInputEvent::MetaKey; | 334 web_input_event_modifiers |= WebKit::WebInputEvent::MetaKey; |
334 return web_input_event_modifiers; | 335 return web_input_event_modifiers; |
335 } | 336 } |
336 | 337 |
| 338 // A LayerDelegate that paints an image for the layer. |
| 339 class ImageLayerDelegate : public ui::LayerDelegate { |
| 340 public: |
| 341 ImageLayerDelegate() {} |
| 342 |
| 343 virtual ~ImageLayerDelegate() {} |
| 344 |
| 345 void SetImage(const gfx::Image& image) { |
| 346 image_ = image; |
| 347 image_size_ = image.AsImageSkia().size(); |
| 348 } |
| 349 const gfx::Image& image() const { return image_; } |
| 350 |
| 351 private: |
| 352 // Overridden from ui::LayerDelegate: |
| 353 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { |
| 354 if (image_.IsEmpty()) { |
| 355 canvas->DrawColor(SK_ColorGRAY); |
| 356 } else { |
| 357 SkISize size = canvas->sk_canvas()->getDeviceSize(); |
| 358 if (size.width() != image_size_.width() || |
| 359 size.height() != image_size_.height()) { |
| 360 canvas->DrawColor(SK_ColorWHITE); |
| 361 } |
| 362 canvas->DrawImageInt(image_.AsImageSkia(), 0, 0); |
| 363 } |
| 364 } |
| 365 |
| 366 // Called when the layer's device scale factor has changed. |
| 367 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { |
| 368 } |
| 369 |
| 370 // Invoked prior to the bounds changing. The returned closured is run after |
| 371 // the bounds change. |
| 372 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { |
| 373 return base::Closure(); |
| 374 } |
| 375 |
| 376 gfx::Image image_; |
| 377 gfx::Size image_size_; |
| 378 |
| 379 DISALLOW_COPY_AND_ASSIGN(ImageLayerDelegate); |
| 380 }; |
| 381 |
337 } // namespace | 382 } // namespace |
338 | 383 |
339 // When a history navigation is triggered at the end of an overscroll | 384 // When a history navigation is triggered at the end of an overscroll |
340 // navigation, it is necessary to show the history-screenshot until the page is | 385 // navigation, it is necessary to show the history-screenshot until the page is |
341 // done navigating and painting. This class accomplishes this by showing the | 386 // done navigating and painting. This class accomplishes this by showing the |
342 // screenshot window on top of the page until the page has completed loading and | 387 // screenshot window on top of the page until the page has completed loading and |
343 // painting. | 388 // painting. |
344 class OverscrollNavigationOverlay : | 389 class OverscrollNavigationOverlay : |
345 public RenderWidgetHostViewAura::PaintObserver { | 390 public RenderWidgetHostViewAura::PaintObserver, |
| 391 public WindowSlider::Delegate { |
346 public: | 392 public: |
347 OverscrollNavigationOverlay() | 393 explicit OverscrollNavigationOverlay(WebContentsImpl* web_contents) |
348 : view_(NULL), | 394 : web_contents_(web_contents), |
| 395 image_delegate_(NULL), |
| 396 view_(NULL), |
349 loading_complete_(false), | 397 loading_complete_(false), |
350 received_paint_update_(false), | 398 received_paint_update_(false), |
351 compositor_updated_(false), | 399 compositor_updated_(false), |
352 has_screenshot_(false), | 400 slide_direction_(SLIDE_UNKNOWN), |
353 need_paint_update_(true) { | 401 need_paint_update_(true) { |
354 } | 402 } |
355 | 403 |
356 virtual ~OverscrollNavigationOverlay() { | 404 virtual ~OverscrollNavigationOverlay() { |
357 if (view_) | 405 if (view_) |
358 view_->set_paint_observer(NULL); | 406 view_->set_paint_observer(NULL); |
359 } | 407 } |
360 | 408 |
361 bool has_window() const { return !!window_.get(); } | 409 bool has_window() const { return !!window_.get(); } |
362 | 410 |
363 void StartObservingView(RenderWidgetHostViewAura* view) { | 411 void StartObservingView(RenderWidgetHostViewAura* view) { |
364 if (view_) | 412 if (view_) |
365 view_->set_paint_observer(NULL); | 413 view_->set_paint_observer(NULL); |
366 | 414 |
367 loading_complete_ = false; | 415 loading_complete_ = false; |
368 received_paint_update_ = false; | 416 received_paint_update_ = false; |
369 compositor_updated_ = false; | 417 compositor_updated_ = false; |
370 view_ = view; | 418 view_ = view; |
371 if (view_) | 419 if (view_) |
372 view_->set_paint_observer(this); | 420 view_->set_paint_observer(this); |
373 | 421 |
374 // Make sure the overlay window is on top. | 422 // Make sure the overlay window is on top. |
375 if (window_.get() && window_->parent()) | 423 if (window_.get() && window_->parent()) |
376 window_->parent()->StackChildAtTop(window_.get()); | 424 window_->parent()->StackChildAtTop(window_.get()); |
377 } | 425 } |
378 | 426 |
379 void SetOverlayWindow(scoped_ptr<aura::Window> window, bool has_screenshot) { | 427 void SetOverlayWindow(scoped_ptr<aura::Window> window, |
| 428 ImageWindowDelegate* delegate) { |
380 window_ = window.Pass(); | 429 window_ = window.Pass(); |
381 if (window_.get() && window_->parent()) | 430 if (window_.get() && window_->parent()) |
382 window_->parent()->StackChildAtTop(window_.get()); | 431 window_->parent()->StackChildAtTop(window_.get()); |
383 has_screenshot_ = has_screenshot; | 432 image_delegate_ = delegate; |
| 433 |
| 434 if (window_.get() && delegate->has_image()) { |
| 435 window_slider_.reset(new WindowSlider(this, |
| 436 window_->parent(), |
| 437 window_.get())); |
| 438 slide_direction_ = SLIDE_UNKNOWN; |
| 439 } else { |
| 440 window_slider_.reset(); |
| 441 } |
384 } | 442 } |
385 | 443 |
386 void SetupForTesting() { | 444 void SetupForTesting() { |
387 need_paint_update_ = false; | 445 need_paint_update_ = false; |
388 } | 446 } |
389 | 447 |
390 private: | 448 private: |
391 // Stop observing the page if the page-load has completed and the page has | 449 // Stop observing the page if the page-load has completed and the page has |
392 // been painted. | 450 // been painted, and a window-slide isn't in progress. |
393 void StopObservingIfDone() { | 451 void StopObservingIfDone() { |
394 // If there is a screenshot displayed in the overlay window, then wait for | 452 // If there is a screenshot displayed in the overlay window, then wait for |
395 // the navigated page to complete loading and some paint update before | 453 // the navigated page to complete loading and some paint update before |
396 // hiding the overlay. | 454 // hiding the overlay. |
397 // If there is no screenshot in the overlay window, then hide this view | 455 // If there is no screenshot in the overlay window, then hide this view |
398 // as soon as there is any new painting notification. | 456 // as soon as there is any new painting notification. |
399 if ((need_paint_update_ && !received_paint_update_) || | 457 if ((need_paint_update_ && !received_paint_update_) || |
400 (has_screenshot_ && !loading_complete_)) { | 458 (image_delegate_->has_image() && !loading_complete_)) { |
401 return; | 459 return; |
402 } | 460 } |
403 | 461 |
| 462 // If a slide is in progress, then do not destroy the window or the slide. |
| 463 if (window_slider_.get() && window_slider_->SlideIsInProgress()) |
| 464 return; |
| 465 |
404 window_.reset(); | 466 window_.reset(); |
| 467 image_delegate_ = NULL; |
405 if (view_) { | 468 if (view_) { |
406 view_->set_paint_observer(NULL); | 469 view_->set_paint_observer(NULL); |
407 view_ = NULL; | 470 view_ = NULL; |
408 } | 471 } |
| 472 window_slider_.reset(); |
| 473 } |
| 474 |
| 475 // Creates a layer to be used for window-slide. |offset| is the offset of the |
| 476 // NavigationEntry for the screenshot image to display. |
| 477 ui::Layer* CreateSlideLayer(int offset) { |
| 478 const NavigationControllerImpl& controller = web_contents_->GetController(); |
| 479 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 480 controller.GetEntryAtOffset(offset)); |
| 481 |
| 482 gfx::Image image; |
| 483 if (entry && entry->screenshot()) { |
| 484 std::vector<gfx::ImagePNGRep> image_reps; |
| 485 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), |
| 486 ui::GetScaleFactorForNativeView(window_.get()))); |
| 487 image = gfx::Image(image_reps); |
| 488 } |
| 489 layer_delegate_.SetImage(image); |
| 490 |
| 491 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); |
| 492 layer->set_delegate(&layer_delegate_); |
| 493 return layer; |
| 494 } |
| 495 |
| 496 // Overridden from WindowSlider::Delegate: |
| 497 virtual ui::Layer* CreateBackLayer() OVERRIDE { |
| 498 if (!web_contents_->GetController().CanGoBack()) |
| 499 return NULL; |
| 500 slide_direction_ = SLIDE_BACK; |
| 501 return CreateSlideLayer(-1); |
| 502 } |
| 503 |
| 504 virtual ui::Layer* CreateFrontLayer() OVERRIDE { |
| 505 if (!web_contents_->GetController().CanGoForward()) |
| 506 return NULL; |
| 507 slide_direction_ = SLIDE_FRONT; |
| 508 return CreateSlideLayer(1); |
| 509 } |
| 510 |
| 511 virtual void OnWindowSlideComplete() OVERRIDE { |
| 512 // The |WindowSlider| deletes itself when the slide is completed. So release |
| 513 // the ownership here. |
| 514 WindowSlider* slider ALLOW_UNUSED = window_slider_.release(); |
| 515 |
| 516 if (slide_direction_ == SLIDE_UNKNOWN) { |
| 517 StopObservingIfDone(); |
| 518 return; |
| 519 } |
| 520 |
| 521 // Change the image used for the overlay window. |
| 522 image_delegate_->SetImage(layer_delegate_.image()); |
| 523 window_->layer()->SetTransform(gfx::Transform()); |
| 524 window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size())); |
| 525 |
| 526 // At the end of the slide, the slider gets destroyed. So create a new one |
| 527 // here. |
| 528 window_slider_.reset(new WindowSlider(this, |
| 529 window_->parent(), |
| 530 window_.get())); |
| 531 SlideDirection direction = slide_direction_; |
| 532 slide_direction_ = SLIDE_UNKNOWN; |
| 533 |
| 534 // Reset state and wait for the new navigation page to complete |
| 535 // loading/painting. |
| 536 StartObservingView(ToRenderWidgetHostViewAura( |
| 537 web_contents_->GetRenderWidgetHostView())); |
| 538 |
| 539 // Perform the navigation. |
| 540 if (direction == SLIDE_BACK) |
| 541 web_contents_->GetController().GoBack(); |
| 542 else if (direction == SLIDE_FRONT) |
| 543 web_contents_->GetController().GoForward(); |
| 544 else |
| 545 NOTREACHED(); |
| 546 } |
| 547 |
| 548 virtual void OnWindowSlideAborted() OVERRIDE { |
| 549 StopObservingIfDone(); |
| 550 } |
| 551 |
| 552 virtual void OnWindowSliderDestroyed() OVERRIDE { |
| 553 // The slider has just been destroyed. Release the ownership. |
| 554 WindowSlider* slider ALLOW_UNUSED = window_slider_.release(); |
| 555 StopObservingIfDone(); |
409 } | 556 } |
410 | 557 |
411 // Overridden from RenderWidgetHostViewAura::PaintObserver: | 558 // Overridden from RenderWidgetHostViewAura::PaintObserver: |
412 virtual void OnPaintComplete() OVERRIDE { | 559 virtual void OnPaintComplete() OVERRIDE { |
413 received_paint_update_ = true; | 560 received_paint_update_ = true; |
414 StopObservingIfDone(); | 561 StopObservingIfDone(); |
415 } | 562 } |
416 | 563 |
417 virtual void OnCompositingComplete() OVERRIDE { | 564 virtual void OnCompositingComplete() OVERRIDE { |
418 received_paint_update_ = compositor_updated_; | 565 received_paint_update_ = compositor_updated_; |
419 StopObservingIfDone(); | 566 StopObservingIfDone(); |
420 } | 567 } |
421 | 568 |
422 virtual void OnUpdateCompositorContent() OVERRIDE { | 569 virtual void OnUpdateCompositorContent() OVERRIDE { |
423 compositor_updated_ = true; | 570 compositor_updated_ = true; |
424 } | 571 } |
425 | 572 |
426 virtual void OnPageLoadComplete() OVERRIDE { | 573 virtual void OnPageLoadComplete() OVERRIDE { |
427 loading_complete_ = true; | 574 loading_complete_ = true; |
428 StopObservingIfDone(); | 575 StopObservingIfDone(); |
429 } | 576 } |
430 | 577 |
431 virtual void OnViewDestroyed() OVERRIDE { | 578 virtual void OnViewDestroyed() OVERRIDE { |
432 DCHECK(view_); | 579 DCHECK(view_); |
433 view_->set_paint_observer(NULL); | 580 view_->set_paint_observer(NULL); |
434 view_ = NULL; | 581 view_ = NULL; |
435 } | 582 } |
436 | 583 |
| 584 // The WebContents which is being navigated. |
| 585 WebContentsImpl* web_contents_; |
| 586 |
437 scoped_ptr<aura::Window> window_; | 587 scoped_ptr<aura::Window> window_; |
| 588 |
| 589 // This is the WindowDelegate of |window_|. The delegate manages its own |
| 590 // lifetime (destroys itself when |window_| is destroyed). |
| 591 ImageWindowDelegate* image_delegate_; |
| 592 |
438 RenderWidgetHostViewAura* view_; | 593 RenderWidgetHostViewAura* view_; |
439 bool loading_complete_; | 594 bool loading_complete_; |
440 bool received_paint_update_; | 595 bool received_paint_update_; |
441 bool compositor_updated_; | 596 bool compositor_updated_; |
442 bool has_screenshot_; | 597 |
| 598 enum SlideDirection { |
| 599 SLIDE_UNKNOWN, |
| 600 SLIDE_BACK, |
| 601 SLIDE_FRONT |
| 602 }; |
| 603 |
| 604 // The |WindowSlider| that allows sliding history layers while the page is |
| 605 // being reloaded. |
| 606 scoped_ptr<WindowSlider> window_slider_; |
| 607 |
| 608 // The direction of the in-progress slide (if any). |
| 609 SlideDirection slide_direction_; |
| 610 |
| 611 // The LayerDelegate used for the back/front layers during a slide. |
| 612 ImageLayerDelegate layer_delegate_; |
443 | 613 |
444 // During tests, the aura windows don't get any paint updates. So the overlay | 614 // During tests, the aura windows don't get any paint updates. So the overlay |
445 // container keeps waiting for a paint update it never receives, causing a | 615 // container keeps waiting for a paint update it never receives, causing a |
446 // timeout. So during tests, disable the wait for paint updates. | 616 // timeout. So during tests, disable the wait for paint updates. |
447 bool need_paint_update_; | 617 bool need_paint_update_; |
448 | 618 |
449 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 619 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
450 }; | 620 }; |
451 | 621 |
452 class WebContentsViewAura::WindowObserver | 622 class WebContentsViewAura::WindowObserver |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 return gfx::Vector2d(std::min(bounds.width(), delta_x), 0); | 982 return gfx::Vector2d(std::min(bounds.width(), delta_x), 0); |
813 | 983 |
814 return gfx::Vector2d(); | 984 return gfx::Vector2d(); |
815 } | 985 } |
816 | 986 |
817 void WebContentsViewAura::PrepareOverscrollNavigationOverlay() { | 987 void WebContentsViewAura::PrepareOverscrollNavigationOverlay() { |
818 OverscrollWindowDelegate* delegate = static_cast<OverscrollWindowDelegate*>( | 988 OverscrollWindowDelegate* delegate = static_cast<OverscrollWindowDelegate*>( |
819 overscroll_window_->delegate()); | 989 overscroll_window_->delegate()); |
820 overscroll_window_->SchedulePaintInRect( | 990 overscroll_window_->SchedulePaintInRect( |
821 gfx::Rect(overscroll_window_->bounds().size())); | 991 gfx::Rect(overscroll_window_->bounds().size())); |
| 992 overscroll_window_->SetBounds(gfx::Rect(window_->bounds().size())); |
| 993 overscroll_window_->SetTransform(gfx::Transform()); |
822 navigation_overlay_->SetOverlayWindow(overscroll_window_.Pass(), | 994 navigation_overlay_->SetOverlayWindow(overscroll_window_.Pass(), |
823 delegate->has_image()); | 995 delegate); |
824 navigation_overlay_->StartObservingView(ToRenderWidgetHostViewAura( | 996 navigation_overlay_->StartObservingView(ToRenderWidgetHostViewAura( |
825 web_contents_->GetRenderWidgetHostView())); | 997 web_contents_->GetRenderWidgetHostView())); |
826 } | 998 } |
827 | 999 |
828 void WebContentsViewAura::UpdateOverscrollWindowBrightness(float delta_x) { | 1000 void WebContentsViewAura::UpdateOverscrollWindowBrightness(float delta_x) { |
829 if (!overscroll_change_brightness_) | 1001 if (!overscroll_change_brightness_) |
830 return; | 1002 return; |
831 | 1003 |
832 const float kBrightnessMin = -.1f; | 1004 const float kBrightnessMin = -.1f; |
833 const float kBrightnessMax = -.01f; | 1005 const float kBrightnessMax = -.01f; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 // We listen to drag drop events in the newly created view's window. | 1174 // We listen to drag drop events in the newly created view's window. |
1003 aura::client::SetDragDropDelegate(view->GetNativeView(), this); | 1175 aura::client::SetDragDropDelegate(view->GetNativeView(), this); |
1004 | 1176 |
1005 RenderWidgetHostImpl* host_impl = | 1177 RenderWidgetHostImpl* host_impl = |
1006 RenderWidgetHostImpl::From(render_widget_host); | 1178 RenderWidgetHostImpl::From(render_widget_host); |
1007 if (host_impl->overscroll_controller() && | 1179 if (host_impl->overscroll_controller() && |
1008 (!web_contents_->GetDelegate() || | 1180 (!web_contents_->GetDelegate() || |
1009 web_contents_->GetDelegate()->CanOverscrollContent())) { | 1181 web_contents_->GetDelegate()->CanOverscrollContent())) { |
1010 host_impl->overscroll_controller()->set_delegate(this); | 1182 host_impl->overscroll_controller()->set_delegate(this); |
1011 if (!navigation_overlay_) | 1183 if (!navigation_overlay_) |
1012 navigation_overlay_.reset(new OverscrollNavigationOverlay()); | 1184 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); |
1013 } | 1185 } |
1014 | 1186 |
1015 AttachTouchEditableToRenderView(); | 1187 AttachTouchEditableToRenderView(); |
1016 return view; | 1188 return view; |
1017 } | 1189 } |
1018 | 1190 |
1019 RenderWidgetHostView* WebContentsViewAura::CreateViewForPopupWidget( | 1191 RenderWidgetHostView* WebContentsViewAura::CreateViewForPopupWidget( |
1020 RenderWidgetHost* render_widget_host) { | 1192 RenderWidgetHost* render_widget_host) { |
1021 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); | 1193 return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); |
1022 } | 1194 } |
(...skipping 18 matching lines...) Expand all Loading... |
1041 web_contents_->GetRenderViewHost()); | 1213 web_contents_->GetRenderViewHost()); |
1042 if (host) { | 1214 if (host) { |
1043 host->SetOverscrollControllerEnabled(enabled); | 1215 host->SetOverscrollControllerEnabled(enabled); |
1044 if (enabled) | 1216 if (enabled) |
1045 host->overscroll_controller()->set_delegate(this); | 1217 host->overscroll_controller()->set_delegate(this); |
1046 } | 1218 } |
1047 | 1219 |
1048 if (!enabled) | 1220 if (!enabled) |
1049 navigation_overlay_.reset(); | 1221 navigation_overlay_.reset(); |
1050 else if (!navigation_overlay_) | 1222 else if (!navigation_overlay_) |
1051 navigation_overlay_.reset(new OverscrollNavigationOverlay()); | 1223 navigation_overlay_.reset(new OverscrollNavigationOverlay(web_contents_)); |
1052 } | 1224 } |
1053 | 1225 |
1054 //////////////////////////////////////////////////////////////////////////////// | 1226 //////////////////////////////////////////////////////////////////////////////// |
1055 // WebContentsViewAura, RenderViewHostDelegateView implementation: | 1227 // WebContentsViewAura, RenderViewHostDelegateView implementation: |
1056 | 1228 |
1057 void WebContentsViewAura::ShowContextMenu(const ContextMenuParams& params) { | 1229 void WebContentsViewAura::ShowContextMenu(const ContextMenuParams& params) { |
1058 if (delegate_) | 1230 if (delegate_) |
1059 delegate_->ShowContextMenu(params); | 1231 delegate_->ShowContextMenu(params); |
1060 if (touch_editable_) | 1232 if (touch_editable_) |
1061 touch_editable_->EndTouchEditing(); | 1233 touch_editable_->EndTouchEditing(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 event.location(), | 1587 event.location(), |
1416 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1588 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1417 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1589 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1418 if (drag_dest_delegate_) | 1590 if (drag_dest_delegate_) |
1419 drag_dest_delegate_->OnDrop(); | 1591 drag_dest_delegate_->OnDrop(); |
1420 current_drop_data_.reset(); | 1592 current_drop_data_.reset(); |
1421 return current_drag_op_; | 1593 return current_drag_op_; |
1422 } | 1594 } |
1423 | 1595 |
1424 } // namespace content | 1596 } // namespace content |
OLD | NEW |