Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: components/dom_distiller/content/distiller_page_web_contents.cc

Issue 1004223002: Pass more information by argument to the dom_distiller script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (render_view_size.IsEmpty()) 64 if (render_view_size.IsEmpty())
65 render_view_size_ = web_contents_->GetContainerBounds().size(); 65 render_view_size_ = web_contents_->GetContainerBounds().size();
66 } 66 }
67 } 67 }
68 68
69 DistillerPageWebContents::~DistillerPageWebContents() { 69 DistillerPageWebContents::~DistillerPageWebContents() {
70 if (web_contents_) 70 if (web_contents_)
71 web_contents_->SetDelegate(NULL); 71 web_contents_->SetDelegate(NULL);
72 } 72 }
73 73
74 bool DistillerPageWebContents::StringifyOutput() {
75 return false;
76 }
77
78 bool DistillerPageWebContents::CreateNewContext() {
79 return true;
80 }
81
74 void DistillerPageWebContents::DistillPageImpl(const GURL& url, 82 void DistillerPageWebContents::DistillPageImpl(const GURL& url,
75 const std::string& script) { 83 const std::string& script) {
76 DCHECK(browser_context_); 84 DCHECK(browser_context_);
77 DCHECK(state_ == IDLE); 85 DCHECK(state_ == IDLE);
78 state_ = LOADING_PAGE; 86 state_ = LOADING_PAGE;
79 script_ = script; 87 script_ = script;
80 88
81 if (web_contents_ && web_contents_->GetLastCommittedURL() == url) { 89 if (web_contents_ && web_contents_->GetLastCommittedURL() == url) {
82 WebContentsMainFrameObserver* main_frame_observer = 90 WebContentsMainFrameObserver* main_frame_observer =
83 WebContentsMainFrameObserver::FromWebContents(web_contents_.get()); 91 WebContentsMainFrameObserver::FromWebContents(web_contents_.get());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698