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/distiller_page_web_contents.h" | 5 #include "components/dom_distiller/content/distiller_page_web_contents.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (render_frame_host == | 155 if (render_frame_host == |
156 source_page_handle_->web_contents()->GetMainFrame()) { | 156 source_page_handle_->web_contents()->GetMainFrame()) { |
157 ExecuteJavaScript(); | 157 ExecuteJavaScript(); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void DistillerPageWebContents::DidFailLoad( | 161 void DistillerPageWebContents::DidFailLoad( |
162 content::RenderFrameHost* render_frame_host, | 162 content::RenderFrameHost* render_frame_host, |
163 const GURL& validated_url, | 163 const GURL& validated_url, |
164 int error_code, | 164 int error_code, |
165 const base::string16& error_description) { | 165 const base::string16& error_description, |
| 166 bool was_ignored_by_handler) { |
166 if (!render_frame_host->GetParent()) { | 167 if (!render_frame_host->GetParent()) { |
167 content::WebContentsObserver::Observe(NULL); | 168 content::WebContentsObserver::Observe(NULL); |
168 DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT); | 169 DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT); |
169 state_ = PAGELOAD_FAILED; | 170 state_ = PAGELOAD_FAILED; |
170 scoped_ptr<base::Value> empty = base::Value::CreateNullValue(); | 171 scoped_ptr<base::Value> empty = base::Value::CreateNullValue(); |
171 OnWebContentsDistillationDone(GURL(), base::TimeTicks(), empty.get()); | 172 OnWebContentsDistillationDone(GURL(), base::TimeTicks(), empty.get()); |
172 } | 173 } |
173 } | 174 } |
174 | 175 |
175 void DistillerPageWebContents::ExecuteJavaScript() { | 176 void DistillerPageWebContents::ExecuteJavaScript() { |
(...skipping 26 matching lines...) Expand all Loading... |
202 if (!javascript_start.is_null()) { | 203 if (!javascript_start.is_null()) { |
203 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start; | 204 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start; |
204 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time); | 205 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time); |
205 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time; | 206 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time; |
206 } | 207 } |
207 | 208 |
208 DistillerPage::OnDistillationDone(page_url, value); | 209 DistillerPage::OnDistillationDone(page_url, value); |
209 } | 210 } |
210 | 211 |
211 } // namespace dom_distiller | 212 } // namespace dom_distiller |
OLD | NEW |