| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/dom_distiller/content/browser/distiller_page_web_contents.h
" | 5 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h
" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 gfx::Size DistillerPageWebContents::GetSizeForNewRenderView( | 137 gfx::Size DistillerPageWebContents::GetSizeForNewRenderView( |
| 138 content::WebContents* web_contents) const { | 138 content::WebContents* web_contents) const { |
| 139 gfx::Size size(render_view_size_); | 139 gfx::Size size(render_view_size_); |
| 140 if (size.IsEmpty()) | 140 if (size.IsEmpty()) |
| 141 size = web_contents->GetContainerBounds().size(); | 141 size = web_contents->GetContainerBounds().size(); |
| 142 // If size is still empty, set it to fullscreen so that document.offsetWidth | 142 // If size is still empty, set it to fullscreen so that document.offsetWidth |
| 143 // in the executed domdistiller.js won't be 0. | 143 // in the executed domdistiller.js won't be 0. |
| 144 if (size.IsEmpty()) { | 144 if (size.IsEmpty()) { |
| 145 DVLOG(1) << "Using fullscreen as default RenderView size"; | 145 DVLOG(1) << "Using fullscreen as default RenderView size"; |
| 146 size = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size(); | 146 size = gfx::Screen::GetScreen()->GetPrimaryDisplay().size(); |
| 147 } | 147 } |
| 148 return size; | 148 return size; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void DistillerPageWebContents::DocumentLoadedInFrame( | 151 void DistillerPageWebContents::DocumentLoadedInFrame( |
| 152 content::RenderFrameHost* render_frame_host) { | 152 content::RenderFrameHost* render_frame_host) { |
| 153 if (render_frame_host == | 153 if (render_frame_host == |
| 154 source_page_handle_->web_contents()->GetMainFrame()) { | 154 source_page_handle_->web_contents()->GetMainFrame()) { |
| 155 ExecuteJavaScript(); | 155 ExecuteJavaScript(); |
| 156 } | 156 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (!javascript_start.is_null()) { | 201 if (!javascript_start.is_null()) { |
| 202 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start; | 202 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start; |
| 203 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time); | 203 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time); |
| 204 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time; | 204 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time; |
| 205 } | 205 } |
| 206 | 206 |
| 207 DistillerPage::OnDistillationDone(page_url, value); | 207 DistillerPage::OnDistillationDone(page_url, value); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace dom_distiller | 210 } // namespace dom_distiller |
| OLD | NEW |