OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
6 | 6 |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/web_contents/aura/image_window_delegate.h" | 9 #include "content/browser/web_contents/aura/image_window_delegate.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/base/layout.h" |
15 #include "ui/compositor/layer.h" | 16 #include "ui/compositor/layer.h" |
16 #include "ui/compositor/layer_animation_observer.h" | 17 #include "ui/compositor/layer_animation_observer.h" |
17 #include "ui/compositor/scoped_layer_animation_settings.h" | 18 #include "ui/compositor/scoped_layer_animation_settings.h" |
18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/image/image_png_rep.h" | 20 #include "ui/gfx/image/image_png_rep.h" |
20 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 // A LayerDelegate that paints an image for the layer. | 25 // A LayerDelegate that paints an image for the layer. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { | 191 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { |
191 const NavigationControllerImpl& controller = web_contents_->GetController(); | 192 const NavigationControllerImpl& controller = web_contents_->GetController(); |
192 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 193 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
193 controller.GetEntryAtOffset(offset)); | 194 controller.GetEntryAtOffset(offset)); |
194 | 195 |
195 gfx::Image image; | 196 gfx::Image image; |
196 if (entry && entry->screenshot().get()) { | 197 if (entry && entry->screenshot().get()) { |
197 std::vector<gfx::ImagePNGRep> image_reps; | 198 std::vector<gfx::ImagePNGRep> image_reps; |
198 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), | 199 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), |
199 ui::GetImageScale( | 200 ui::GetScaleFactorForNativeView(window_.get()))); |
200 ui::GetScaleFactorForNativeView(window_.get())))); | |
201 image = gfx::Image(image_reps); | 201 image = gfx::Image(image_reps); |
202 } | 202 } |
203 if (!layer_delegate_) | 203 if (!layer_delegate_) |
204 layer_delegate_.reset(new ImageLayerDelegate()); | 204 layer_delegate_.reset(new ImageLayerDelegate()); |
205 layer_delegate_->SetImage(image); | 205 layer_delegate_->SetImage(image); |
206 | 206 |
207 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); | 207 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); |
208 layer->set_delegate(layer_delegate_.get()); | 208 layer->set_delegate(layer_delegate_.get()); |
209 return layer; | 209 return layer; |
210 } | 210 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 bool OverscrollNavigationOverlay::OnMessageReceived( | 342 bool OverscrollNavigationOverlay::OnMessageReceived( |
343 const IPC::Message& message) { | 343 const IPC::Message& message) { |
344 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 344 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
345 IPC_BEGIN_MESSAGE_MAP(OverscrollNavigationOverlay, message) | 345 IPC_BEGIN_MESSAGE_MAP(OverscrollNavigationOverlay, message) |
346 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 346 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
347 IPC_END_MESSAGE_MAP() | 347 IPC_END_MESSAGE_MAP() |
348 return false; | 348 return false; |
349 } | 349 } |
350 | 350 |
351 } // namespace content | 351 } // namespace content |
OLD | NEW |