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

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: Removing stale comments. 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)) &&
Lei Zhang 2015/10/29 19:14:57 nit: Too many parenthesis. Just !cmdline->Foo() &&
mvendramini_hp 2015/10/30 11:05:36 Done.
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) {
1306 VLOG(1) << "Distillable page detection finished";
1307 if (distillable)
1308 web_ui()->CallJavascriptFunction("detectDistillablePage");
1309 }
1310
1311 void PrintPreviewHandler::ClosePreviewDialog() { 1303 void PrintPreviewHandler::ClosePreviewDialog() {
1312 print_preview_ui()->OnClosePrintPreviewDialog(); 1304 print_preview_ui()->OnClosePrintPreviewDialog();
1313 } 1305 }
1314 1306
1315 void PrintPreviewHandler::SendAccessToken(const std::string& type, 1307 void PrintPreviewHandler::SendAccessToken(const std::string& type,
1316 const std::string& access_token) { 1308 const std::string& access_token) {
1317 VLOG(1) << "Get getAccessToken finished"; 1309 VLOG(1) << "Get getAccessToken finished";
1318 web_ui()->CallJavascriptFunction("onDidGetAccessToken", 1310 web_ui()->CallJavascriptFunction("onDidGetAccessToken",
1319 base::StringValue(type), 1311 base::StringValue(type),
1320 base::StringValue(access_token)); 1312 base::StringValue(access_token));
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1808
1817 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1809 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1818 if (gaia_cookie_manager_service_) 1810 if (gaia_cookie_manager_service_)
1819 gaia_cookie_manager_service_->RemoveObserver(this); 1811 gaia_cookie_manager_service_->RemoveObserver(this);
1820 } 1812 }
1821 1813
1822 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1814 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1823 const base::Closure& closure) { 1815 const base::Closure& closure) {
1824 pdf_file_saved_closure_ = closure; 1816 pdf_file_saved_closure_ = closure;
1825 } 1817 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698