| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/dom_distiller/tab_utils.h" | 5 #include "chrome/browser/dom_distiller/tab_utils.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 8 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 9 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 9 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 10 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 10 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 SelfDeletingRequestDelegate* view_request_delegate = | 115 SelfDeletingRequestDelegate* view_request_delegate = |
| 116 new SelfDeletingRequestDelegate(web_contents); | 116 new SelfDeletingRequestDelegate(web_contents); |
| 117 scoped_ptr<content::WebContents> old_web_contents_sptr(web_contents); | 117 scoped_ptr<content::WebContents> old_web_contents_sptr(web_contents); |
| 118 scoped_ptr<SourcePageHandleWebContents> source_page_handle( | 118 scoped_ptr<SourcePageHandleWebContents> source_page_handle( |
| 119 new SourcePageHandleWebContents(old_web_contents_sptr.Pass())); | 119 new SourcePageHandleWebContents(old_web_contents_sptr.Pass())); |
| 120 DomDistillerService* dom_distiller_service = | 120 DomDistillerService* dom_distiller_service = |
| 121 DomDistillerServiceFactory::GetForBrowserContext( | 121 DomDistillerServiceFactory::GetForBrowserContext( |
| 122 web_contents->GetBrowserContext()); | 122 web_contents->GetBrowserContext()); |
| 123 scoped_ptr<DistillerPage> distiller_page = | 123 scoped_ptr<DistillerPage> distiller_page = |
| 124 dom_distiller_service->CreateDefaultDistillerPageWithHandle( | 124 dom_distiller_service->CreateDefaultDistillerPageWithHandle( |
| 125 source_page_handle.PassAs<SourcePageHandle>()) | 125 source_page_handle.Pass()).Pass(); |
| 126 .Pass(); | |
| 127 | 126 |
| 128 const GURL& last_committed_url = web_contents->GetLastCommittedURL(); | 127 const GURL& last_committed_url = web_contents->GetLastCommittedURL(); |
| 129 scoped_ptr<ViewerHandle> viewer_handle = dom_distiller_service->ViewUrl( | 128 scoped_ptr<ViewerHandle> viewer_handle = dom_distiller_service->ViewUrl( |
| 130 view_request_delegate, distiller_page.Pass(), last_committed_url); | 129 view_request_delegate, distiller_page.Pass(), last_committed_url); |
| 131 view_request_delegate->TakeViewerHandle(viewer_handle.Pass()); | 130 view_request_delegate->TakeViewerHandle(viewer_handle.Pass()); |
| 132 } | 131 } |
| 133 | 132 |
| 134 } // namespace | 133 } // namespace |
| 135 | 134 |
| 136 void DistillCurrentPageAndView(content::WebContents* old_web_contents) { | 135 void DistillCurrentPageAndView(content::WebContents* old_web_contents) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 // difficult to distinguish between the intermediate reload and a user hitting | 150 // difficult to distinguish between the intermediate reload and a user hitting |
| 152 // the back button. | 151 // the back button. |
| 153 StartNavigationToDistillerViewer(new_web_contents, | 152 StartNavigationToDistillerViewer(new_web_contents, |
| 154 old_web_contents->GetLastCommittedURL()); | 153 old_web_contents->GetLastCommittedURL()); |
| 155 | 154 |
| 156 CoreTabHelper::FromWebContents(old_web_contents)->delegate()->SwapTabContents( | 155 CoreTabHelper::FromWebContents(old_web_contents)->delegate()->SwapTabContents( |
| 157 old_web_contents, new_web_contents, false, false); | 156 old_web_contents, new_web_contents, false, false); |
| 158 | 157 |
| 159 StartDistillation(old_web_contents); | 158 StartDistillation(old_web_contents); |
| 160 } | 159 } |
| OLD | NEW |