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

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

Issue 1248643004: Test distillability without JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@early
Patch Set: fix browsertest, merge webkit CL, merge http://crrev.com/1403413004 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
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" 51 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
52 #include "chrome/common/chrome_paths.h" 52 #include "chrome/common/chrome_paths.h"
53 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
54 #include "chrome/common/cloud_print/cloud_print_cdd_conversion.h" 54 #include "chrome/common/cloud_print/cloud_print_cdd_conversion.h"
55 #include "chrome/common/cloud_print/cloud_print_constants.h" 55 #include "chrome/common/cloud_print/cloud_print_constants.h"
56 #include "chrome/common/crash_keys.h" 56 #include "chrome/common/crash_keys.h"
57 #include "chrome/common/pref_names.h" 57 #include "chrome/common/pref_names.h"
58 #include "components/cloud_devices/common/cloud_device_description.h" 58 #include "components/cloud_devices/common/cloud_device_description.h"
59 #include "components/cloud_devices/common/cloud_devices_urls.h" 59 #include "components/cloud_devices/common/cloud_devices_urls.h"
60 #include "components/cloud_devices/common/printer_description.h" 60 #include "components/cloud_devices/common/printer_description.h"
61 #include "components/dom_distiller/content/browser/distillable_page_utils.h"
62 #include "components/dom_distiller/core/dom_distiller_switches.h" 61 #include "components/dom_distiller/core/dom_distiller_switches.h"
63 #include "components/dom_distiller/core/url_utils.h" 62 #include "components/dom_distiller/core/url_utils.h"
64 #include "components/printing/common/print_messages.h" 63 #include "components/printing/common/print_messages.h"
65 #include "components/signin/core/browser/gaia_cookie_manager_service.h" 64 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
66 #include "components/signin/core/browser/profile_oauth2_token_service.h" 65 #include "components/signin/core/browser/profile_oauth2_token_service.h"
67 #include "components/signin/core/browser/signin_manager.h" 66 #include "components/signin/core/browser/signin_manager.h"
68 #include "components/signin/core/common/profile_management_switches.h" 67 #include "components/signin/core/common/profile_management_switches.h"
69 #include "content/public/browser/browser_context.h" 68 #include "content/public/browser/browser_context.h"
70 #include "content/public/browser/browser_thread.h" 69 #include "content/public/browser/browser_thread.h"
71 #include "content/public/browser/navigation_controller.h" 70 #include "content/public/browser/navigation_controller.h"
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 #endif 1277 #endif
1279 1278
1280 if (print_preview_ui()->source_is_modifiable()) 1279 if (print_preview_ui()->source_is_modifiable())
1281 GetNumberFormatAndMeasurementSystem(&initial_settings); 1280 GetNumberFormatAndMeasurementSystem(&initial_settings);
1282 web_ui()->CallJavascriptFunction("setInitialSettings", initial_settings); 1281 web_ui()->CallJavascriptFunction("setInitialSettings", initial_settings);
1283 1282
1284 WebContents* initiator = GetInitiator(); 1283 WebContents* initiator = GetInitiator();
1285 if (initiator && cmdline->HasSwitch(switches::kEnableDomDistiller) && 1284 if (initiator && cmdline->HasSwitch(switches::kEnableDomDistiller) &&
1286 dom_distiller::url_utils::IsUrlDistillable( 1285 dom_distiller::url_utils::IsUrlDistillable(
1287 initiator->GetLastCommittedURL())) { 1286 initiator->GetLastCommittedURL())) {
1288 dom_distiller::IsDistillablePage( 1287 web_ui()->CallJavascriptFunction("detectDistillablePage");
1289 initiator, false,
1290 base::Bind(&PrintPreviewHandler::HandleIsPageDistillableResult,
1291 weak_factory_.GetWeakPtr()));
1292 } 1288 }
1293 } 1289 }
1294 1290
1295 void PrintPreviewHandler::HandleIsPageDistillableResult(bool distillable) {
1296 VLOG(1) << "Distillable page detection finished";
1297 if (distillable)
1298 web_ui()->CallJavascriptFunction("detectDistillablePage");
1299 }
1300
1301 void PrintPreviewHandler::ClosePreviewDialog() { 1291 void PrintPreviewHandler::ClosePreviewDialog() {
1302 print_preview_ui()->OnClosePrintPreviewDialog(); 1292 print_preview_ui()->OnClosePrintPreviewDialog();
1303 } 1293 }
1304 1294
1305 void PrintPreviewHandler::SendAccessToken(const std::string& type, 1295 void PrintPreviewHandler::SendAccessToken(const std::string& type,
1306 const std::string& access_token) { 1296 const std::string& access_token) {
1307 VLOG(1) << "Get getAccessToken finished"; 1297 VLOG(1) << "Get getAccessToken finished";
1308 web_ui()->CallJavascriptFunction("onDidGetAccessToken", 1298 web_ui()->CallJavascriptFunction("onDidGetAccessToken",
1309 base::StringValue(type), 1299 base::StringValue(type),
1310 base::StringValue(access_token)); 1300 base::StringValue(access_token));
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 1796
1807 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1797 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1808 if (gaia_cookie_manager_service_) 1798 if (gaia_cookie_manager_service_)
1809 gaia_cookie_manager_service_->RemoveObserver(this); 1799 gaia_cookie_manager_service_->RemoveObserver(this);
1810 } 1800 }
1811 1801
1812 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1802 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1813 const base::Closure& closure) { 1803 const base::Closure& closure) {
1814 pdf_file_saved_closure_ = closure; 1804 pdf_file_saved_closure_ = closure;
1815 } 1805 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698