| 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 "athena/content/content_proxy.h" | 5 #include "athena/content/content_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/threading/worker_pool.h" | 8 #include "base/threading/worker_pool.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 png_data_->Release(); | 94 png_data_->Release(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ContentProxy::OnPreContentDestroyed() { | 97 void ContentProxy::OnPreContentDestroyed() { |
| 98 // Since we are breaking now the connection to the old content, we make the | 98 // Since we are breaking now the connection to the old content, we make the |
| 99 // content visible again before we continue. | 99 // content visible again before we continue. |
| 100 // Note: Since the owning window is invisible, it does not matter that we | 100 // Note: Since the owning window is invisible, it does not matter that we |
| 101 // make the web content visible if the window gets destroyed shortly after. | 101 // make the web content visible if the window gets destroyed shortly after. |
| 102 ShowOriginalContent(); | 102 ShowOriginalContent(); |
| 103 | 103 |
| 104 web_view_ = NULL; | 104 web_view_ = nullptr; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ContentProxy::ShowOriginalContent() { | 107 void ContentProxy::ShowOriginalContent() { |
| 108 if (web_view_ && !content_visible_) { | 108 if (web_view_ && !content_visible_) { |
| 109 // Show the original |web_view_| again. | 109 // Show the original |web_view_| again. |
| 110 web_view_->SetFastResize(false); | 110 web_view_->SetFastResize(false); |
| 111 // If the content is loaded, we ask it to relayout itself since the | 111 // If the content is loaded, we ask it to relayout itself since the |
| 112 // dimensions might have changed. If not, we will reload new content and no | 112 // dimensions might have changed. If not, we will reload new content and no |
| 113 // layout is required for the old content. | 113 // layout is required for the old content. |
| 114 if (content_loaded_) | 114 if (content_loaded_) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 void ContentProxy::OnContentImageEncodeComplete( | 182 void ContentProxy::OnContentImageEncodeComplete( |
| 183 scoped_refptr<ProxyImageData> image) { | 183 scoped_refptr<ProxyImageData> image) { |
| 184 png_data_ = image->data(); | 184 png_data_ = image->data(); |
| 185 | 185 |
| 186 // From now on we decode the image as needed to save memory. | 186 // From now on we decode the image as needed to save memory. |
| 187 raw_image_ = gfx::ImageSkia(); | 187 raw_image_ = gfx::ImageSkia(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace athena | 190 } // namespace athena |
| OLD | NEW |