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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 1419063002: Displaying "simplify page" on print preview by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small refactors, formatting, and removing call to distillation heuristics. Created 5 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/print_preview/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 prefs->GetString(prefs::kPrintPreviewDefaultDestinationSelectionRules); 1285 prefs->GetString(prefs::kPrintPreviewDefaultDestinationSelectionRules);
1286 if (!rules_str.empty()) 1286 if (!rules_str.empty())
1287 initial_settings.SetString(kDefaultDestinationSelectionRules, rules_str); 1287 initial_settings.SetString(kDefaultDestinationSelectionRules, rules_str);
1288 } 1288 }
1289 1289
1290 if (print_preview_ui()->source_is_modifiable()) 1290 if (print_preview_ui()->source_is_modifiable())
1291 GetNumberFormatAndMeasurementSystem(&initial_settings); 1291 GetNumberFormatAndMeasurementSystem(&initial_settings);
1292 web_ui()->CallJavascriptFunction("setInitialSettings", initial_settings); 1292 web_ui()->CallJavascriptFunction("setInitialSettings", initial_settings);
1293 1293
1294 WebContents* initiator = GetInitiator(); 1294 WebContents* initiator = GetInitiator();
1295 if (initiator && cmdline->HasSwitch(switches::kEnableDomDistiller) && 1295 if (initiator &&
1296 !(cmdline->HasSwitch(switches::kDisablePrintPreviewSimplify)) &&
1296 dom_distiller::url_utils::IsUrlDistillable( 1297 dom_distiller::url_utils::IsUrlDistillable(
1297 initiator->GetLastCommittedURL())) { 1298 initiator->GetLastCommittedURL())) {
1298 dom_distiller::IsDistillablePage( 1299 web_ui()->CallJavascriptFunction("allowDistillPage");
1299 initiator, false,
1300 base::Bind(&PrintPreviewHandler::HandleIsPageDistillableResult,
1301 weak_factory_.GetWeakPtr()));
1302 } 1300 }
1303 } 1301 }
1304 1302
1305 void PrintPreviewHandler::HandleIsPageDistillableResult(bool distillable) { 1303 void PrintPreviewHandler::HandleIsPageDistillableResult(bool distillable) {
Vitaly Buka (NO REVIEWS) 2015/10/29 18:44:01 Please remove HandleIsPageDistillableResult as unu
mvendramini_hp 2015/10/29 18:52:32 Done.
1306 VLOG(1) << "Distillable page detection finished"; 1304 VLOG(1) << "Distillable page detection finished";
1307 if (distillable) 1305 if (distillable)
1308 web_ui()->CallJavascriptFunction("detectDistillablePage"); 1306 web_ui()->CallJavascriptFunction("allowDistillPage");
1309 } 1307 }
1310 1308
1311 void PrintPreviewHandler::ClosePreviewDialog() { 1309 void PrintPreviewHandler::ClosePreviewDialog() {
1312 print_preview_ui()->OnClosePrintPreviewDialog(); 1310 print_preview_ui()->OnClosePrintPreviewDialog();
1313 } 1311 }
1314 1312
1315 void PrintPreviewHandler::SendAccessToken(const std::string& type, 1313 void PrintPreviewHandler::SendAccessToken(const std::string& type,
1316 const std::string& access_token) { 1314 const std::string& access_token) {
1317 VLOG(1) << "Get getAccessToken finished"; 1315 VLOG(1) << "Get getAccessToken finished";
1318 web_ui()->CallJavascriptFunction("onDidGetAccessToken", 1316 web_ui()->CallJavascriptFunction("onDidGetAccessToken",
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1814
1817 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1815 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1818 if (gaia_cookie_manager_service_) 1816 if (gaia_cookie_manager_service_)
1819 gaia_cookie_manager_service_->RemoveObserver(this); 1817 gaia_cookie_manager_service_->RemoveObserver(this);
1820 } 1818 }
1821 1819
1822 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1820 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1823 const base::Closure& closure) { 1821 const base::Closure& closure) {
1824 pdf_file_saved_closure_ = closure; 1822 pdf_file_saved_closure_ = closure;
1825 } 1823 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_helpers.cc ('k') | components/dom_distiller/core/dom_distiller_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698