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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/dom_distiller/core/distiller_page.h" | 10 #include "components/dom_distiller/core/distiller_page.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 base::string16(), // frame_xpath | 55 base::string16(), // frame_xpath |
56 base::UTF8ToUTF16(script), | 56 base::UTF8ToUTF16(script), |
57 base::Bind(&DistillerPage::OnExecuteJavaScriptDone, | 57 base::Bind(&DistillerPage::OnExecuteJavaScriptDone, |
58 base::Unretained(this))); | 58 base::Unretained(this))); |
59 } | 59 } |
60 | 60 |
61 void DistillerPageWebContents::DidFinishLoad(int64 frame_id, | 61 void DistillerPageWebContents::DidFinishLoad(int64 frame_id, |
62 const GURL& validated_url, | 62 const GURL& validated_url, |
63 bool is_main_frame, | 63 bool is_main_frame, |
64 RenderViewHost* render_view_host) { | 64 RenderViewHost* render_view_host) { |
65 if (validated_url != web_contents_->GetURL()) { | |
Yaron
2014/01/29 20:03:41
Why are these necessary? To ensure the page wasn't
shashi
2014/01/29 22:51:37
Done, I can use is_main_frame.
| |
66 return; | |
67 } | |
65 content::WebContentsObserver::Observe(NULL); | 68 content::WebContentsObserver::Observe(NULL); |
66 OnLoadURLDone(); | 69 OnLoadURLDone(); |
67 } | 70 } |
71 | |
68 void DistillerPageWebContents::DidFailLoad( | 72 void DistillerPageWebContents::DidFailLoad( |
69 int64 frame_id, | 73 int64 frame_id, |
70 const GURL& validated_url, | 74 const GURL& validated_url, |
71 bool is_main_frame, | 75 bool is_main_frame, |
72 int error_code, | 76 int error_code, |
73 const base::string16& error_description, | 77 const base::string16& error_description, |
74 RenderViewHost* render_view_host) { | 78 RenderViewHost* render_view_host) { |
79 if (validated_url != web_contents_->GetURL()) { | |
80 return; | |
81 } | |
75 content::WebContentsObserver::Observe(NULL); | 82 content::WebContentsObserver::Observe(NULL); |
76 OnLoadURLFailed(); | 83 OnLoadURLFailed(); |
77 } | 84 } |
78 | 85 |
79 } // namespace dom_distiller | 86 } // namespace dom_distiller |
OLD | NEW |