| 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/content/web_contents_main_frame_observer.h" | 10 #include "components/dom_distiller/content/web_contents_main_frame_observer.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DCHECK(web_contents_); | 27 DCHECK(web_contents_); |
| 28 } | 28 } |
| 29 | 29 |
| 30 SourcePageHandleWebContents::~SourcePageHandleWebContents() { | 30 SourcePageHandleWebContents::~SourcePageHandleWebContents() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 scoped_ptr<content::WebContents> SourcePageHandleWebContents::GetWebContents() { | 33 scoped_ptr<content::WebContents> SourcePageHandleWebContents::GetWebContents() { |
| 34 return web_contents_.Pass(); | 34 return web_contents_.Pass(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 DistillerPageWebContentsFactory::DistillerPageWebContentsFactory( |
| 38 content::BrowserContext* browser_context, |
| 39 std::string distiller_js_script) |
| 40 : DistillerPageFactory(), |
| 41 browser_context_(browser_context), |
| 42 distiller_js_script_(distiller_js_script) { |
| 43 } |
| 44 |
| 37 scoped_ptr<DistillerPage> DistillerPageWebContentsFactory::CreateDistillerPage( | 45 scoped_ptr<DistillerPage> DistillerPageWebContentsFactory::CreateDistillerPage( |
| 38 const gfx::Size& render_view_size) const { | 46 const gfx::Size& render_view_size) const { |
| 39 DCHECK(browser_context_); | 47 DCHECK(browser_context_); |
| 40 return scoped_ptr<DistillerPage>(new DistillerPageWebContents( | 48 return scoped_ptr<DistillerPage>(new DistillerPageWebContents( |
| 41 browser_context_, render_view_size, | 49 browser_context_, render_view_size, |
| 42 scoped_ptr<SourcePageHandleWebContents>())); | 50 scoped_ptr<SourcePageHandleWebContents>())); |
| 43 } | 51 } |
| 44 | 52 |
| 45 scoped_ptr<DistillerPage> | 53 scoped_ptr<DistillerPage> |
| 46 DistillerPageWebContentsFactory::CreateDistillerPageWithHandle( | 54 DistillerPageWebContentsFactory::CreateDistillerPageWithHandle( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 177 |
| 170 void DistillerPageWebContents::OnWebContentsDistillationDone( | 178 void DistillerPageWebContents::OnWebContentsDistillationDone( |
| 171 const GURL& page_url, | 179 const GURL& page_url, |
| 172 const base::Value* value) { | 180 const base::Value* value) { |
| 173 DCHECK(state_ == PAGELOAD_FAILED || state_ == EXECUTING_JAVASCRIPT); | 181 DCHECK(state_ == PAGELOAD_FAILED || state_ == EXECUTING_JAVASCRIPT); |
| 174 state_ = IDLE; | 182 state_ = IDLE; |
| 175 DistillerPage::OnDistillationDone(page_url, value); | 183 DistillerPage::OnDistillationDone(page_url, value); |
| 176 } | 184 } |
| 177 | 185 |
| 178 } // namespace dom_distiller | 186 } // namespace dom_distiller |
| OLD | NEW |