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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 content::NavigationController::LoadURLParams params(gurl); | 46 content::NavigationController::LoadURLParams params(gurl); |
47 web_contents_->GetController().LoadURLWithParams(params); | 47 web_contents_->GetController().LoadURLWithParams(params); |
48 } | 48 } |
49 | 49 |
50 void DistillerPageWebContents::ExecuteJavaScriptImpl( | 50 void DistillerPageWebContents::ExecuteJavaScriptImpl( |
51 const std::string& script) { | 51 const std::string& script) { |
52 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); | 52 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); |
53 DCHECK(host); | 53 DCHECK(host); |
54 host->ExecuteJavascriptInWebFrameCallbackResult( | 54 host->ExecuteJavascriptInWebFrameCallbackResult( |
55 base::string16(), // frame_xpath | 55 base::string16(), // frame_xpath |
56 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 content::WebContentsObserver::Observe(NULL); | 65 content::WebContentsObserver::Observe(NULL); |
66 OnLoadURLDone(); | 66 OnLoadURLDone(); |
67 } | 67 } |
68 void DistillerPageWebContents::DidFailLoad( | 68 void DistillerPageWebContents::DidFailLoad( |
69 int64 frame_id, | 69 int64 frame_id, |
70 const GURL& validated_url, | 70 const GURL& validated_url, |
71 bool is_main_frame, | 71 bool is_main_frame, |
72 int error_code, | 72 int error_code, |
73 const base::string16& error_description, | 73 const base::string16& error_description, |
74 RenderViewHost* render_view_host) { | 74 RenderViewHost* render_view_host) { |
75 content::WebContentsObserver::Observe(NULL); | 75 content::WebContentsObserver::Observe(NULL); |
76 OnLoadURLFailed(); | 76 OnLoadURLFailed(); |
77 } | 77 } |
78 | 78 |
79 } // namespace dom_distiller | 79 } // namespace dom_distiller |
OLD | NEW |