| 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" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const NavigationEntryImpl* entry = NULL; | 105 const NavigationEntryImpl* entry = NULL; |
| 106 if (ShouldNavigateForward(controller, overscroll_mode)) { | 106 if (ShouldNavigateForward(controller, overscroll_mode)) { |
| 107 entry = NavigationEntryImpl::FromNavigationEntry( | 107 entry = NavigationEntryImpl::FromNavigationEntry( |
| 108 controller.GetEntryAtOffset(1)); | 108 controller.GetEntryAtOffset(1)); |
| 109 } else if (ShouldNavigateBack(controller, overscroll_mode)) { | 109 } else if (ShouldNavigateBack(controller, overscroll_mode)) { |
| 110 entry = NavigationEntryImpl::FromNavigationEntry( | 110 entry = NavigationEntryImpl::FromNavigationEntry( |
| 111 controller.GetEntryAtOffset(-1)); | 111 controller.GetEntryAtOffset(-1)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 gfx::Image image; | 114 gfx::Image image; |
| 115 if (entry && entry->screenshot()) { | 115 if (entry && entry->screenshot().get()) { |
| 116 std::vector<gfx::ImagePNGRep> image_reps; | 116 std::vector<gfx::ImagePNGRep> image_reps; |
| 117 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), | 117 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), |
| 118 ui::GetScaleFactorForNativeView(web_contents_window()))); | 118 ui::GetScaleFactorForNativeView(web_contents_window()))); |
| 119 image = gfx::Image(image_reps); | 119 image = gfx::Image(image_reps); |
| 120 } | 120 } |
| 121 SetImage(image); | 121 SetImage(image); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void stop_forwarding_events() { forward_events_ = false; } | 124 void stop_forwarding_events() { forward_events_ = false; } |
| 125 | 125 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 | 473 |
| 474 // Creates a layer to be used for window-slide. |offset| is the offset of the | 474 // Creates a layer to be used for window-slide. |offset| is the offset of the |
| 475 // NavigationEntry for the screenshot image to display. | 475 // NavigationEntry for the screenshot image to display. |
| 476 ui::Layer* CreateSlideLayer(int offset) { | 476 ui::Layer* CreateSlideLayer(int offset) { |
| 477 const NavigationControllerImpl& controller = web_contents_->GetController(); | 477 const NavigationControllerImpl& controller = web_contents_->GetController(); |
| 478 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 478 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 479 controller.GetEntryAtOffset(offset)); | 479 controller.GetEntryAtOffset(offset)); |
| 480 | 480 |
| 481 gfx::Image image; | 481 gfx::Image image; |
| 482 if (entry && entry->screenshot()) { | 482 if (entry && entry->screenshot().get()) { |
| 483 std::vector<gfx::ImagePNGRep> image_reps; | 483 std::vector<gfx::ImagePNGRep> image_reps; |
| 484 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), | 484 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), |
| 485 ui::GetScaleFactorForNativeView(window_.get()))); | 485 ui::GetScaleFactorForNativeView(window_.get()))); |
| 486 image = gfx::Image(image_reps); | 486 image = gfx::Image(image_reps); |
| 487 } | 487 } |
| 488 layer_delegate_.SetImage(image); | 488 layer_delegate_.SetImage(image); |
| 489 | 489 |
| 490 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); | 490 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); |
| 491 layer->set_delegate(&layer_delegate_); | 491 layer->set_delegate(&layer_delegate_); |
| 492 return layer; | 492 return layer; |
| (...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 event.location(), | 1578 event.location(), |
| 1579 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1579 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
| 1580 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1580 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1581 if (drag_dest_delegate_) | 1581 if (drag_dest_delegate_) |
| 1582 drag_dest_delegate_->OnDrop(); | 1582 drag_dest_delegate_->OnDrop(); |
| 1583 current_drop_data_.reset(); | 1583 current_drop_data_.reset(); |
| 1584 return current_drag_op_; | 1584 return current_drag_op_; |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 } // namespace content | 1587 } // namespace content |
| OLD | NEW |