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

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

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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/browser/distiller_page_web_contents.h " 5 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h "
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ptr_util.h"
11 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h" 14 #include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
14 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser ver.h" 15 #include "components/dom_distiller/content/browser/web_contents_main_frame_obser ver.h"
15 #include "components/dom_distiller/core/distiller_page.h" 16 #include "components/dom_distiller/core/distiller_page.h"
16 #include "components/dom_distiller/core/dom_distiller_constants.h" 17 #include "components/dom_distiller/core/dom_distiller_constants.h"
17 #include "components/dom_distiller/core/dom_distiller_service.h" 18 #include "components/dom_distiller/core/dom_distiller_service.h"
18 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/render_frame_host.h" 21 #include "content/public/browser/render_frame_host.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void DistillerPageWebContents::DidFailLoad( 162 void DistillerPageWebContents::DidFailLoad(
162 content::RenderFrameHost* render_frame_host, 163 content::RenderFrameHost* render_frame_host,
163 const GURL& validated_url, 164 const GURL& validated_url,
164 int error_code, 165 int error_code,
165 const base::string16& error_description, 166 const base::string16& error_description,
166 bool was_ignored_by_handler) { 167 bool was_ignored_by_handler) {
167 if (!render_frame_host->GetParent()) { 168 if (!render_frame_host->GetParent()) {
168 content::WebContentsObserver::Observe(NULL); 169 content::WebContentsObserver::Observe(NULL);
169 DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT); 170 DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT);
170 state_ = PAGELOAD_FAILED; 171 state_ = PAGELOAD_FAILED;
171 std::unique_ptr<base::Value> empty = base::Value::CreateNullValue(); 172 auto empty = base::MakeUnique<base::Value>();
172 OnWebContentsDistillationDone(GURL(), base::TimeTicks(), empty.get()); 173 OnWebContentsDistillationDone(GURL(), base::TimeTicks(), empty.get());
173 } 174 }
174 } 175 }
175 176
176 void DistillerPageWebContents::ExecuteJavaScript() { 177 void DistillerPageWebContents::ExecuteJavaScript() {
177 content::RenderFrameHost* frame = 178 content::RenderFrameHost* frame =
178 source_page_handle_->web_contents()->GetMainFrame(); 179 source_page_handle_->web_contents()->GetMainFrame();
179 DCHECK(frame); 180 DCHECK(frame);
180 DCHECK_EQ(LOADING_PAGE, state_); 181 DCHECK_EQ(LOADING_PAGE, state_);
181 state_ = EXECUTING_JAVASCRIPT; 182 state_ = EXECUTING_JAVASCRIPT;
(...skipping 21 matching lines...) Expand all
203 if (!javascript_start.is_null()) { 204 if (!javascript_start.is_null()) {
204 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start; 205 base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start;
205 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time); 206 UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time);
206 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time; 207 DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time;
207 } 208 }
208 209
209 DistillerPage::OnDistillationDone(page_url, value); 210 DistillerPage::OnDistillationDone(page_url, value);
210 } 211 }
211 212
212 } // namespace dom_distiller 213 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/arc/bluetooth/bluetooth_type_converters_unittest.cc ('k') | components/dom_distiller/core/distiller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698