| OLD | NEW |
| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 67 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| 68 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 68 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 69 #include "components/signin/core/browser/signin_manager.h" | 69 #include "components/signin/core/browser/signin_manager.h" |
| 70 #include "components/signin/core/common/profile_management_switches.h" | 70 #include "components/signin/core/common/profile_management_switches.h" |
| 71 #include "content/public/browser/browser_context.h" | 71 #include "content/public/browser/browser_context.h" |
| 72 #include "content/public/browser/browser_thread.h" | 72 #include "content/public/browser/browser_thread.h" |
| 73 #include "content/public/browser/navigation_controller.h" | 73 #include "content/public/browser/navigation_controller.h" |
| 74 #include "content/public/browser/navigation_entry.h" | 74 #include "content/public/browser/navigation_entry.h" |
| 75 #include "content/public/browser/render_frame_host.h" | 75 #include "content/public/browser/render_frame_host.h" |
| 76 #include "content/public/browser/render_process_host.h" | 76 #include "content/public/browser/render_process_host.h" |
| 77 #include "content/public/browser/render_view_host.h" |
| 77 #include "content/public/browser/web_contents.h" | 78 #include "content/public/browser/web_contents.h" |
| 78 #include "content/public/browser/web_ui.h" | 79 #include "content/public/browser/web_ui.h" |
| 79 #include "google_apis/gaia/oauth2_token_service.h" | 80 #include "google_apis/gaia/oauth2_token_service.h" |
| 80 #include "net/base/url_util.h" | 81 #include "net/base/url_util.h" |
| 81 #include "printing/backend/print_backend.h" | 82 #include "printing/backend/print_backend.h" |
| 82 #include "printing/backend/print_backend_consts.h" | 83 #include "printing/backend/print_backend_consts.h" |
| 83 #include "printing/features/features.h" | 84 #include "printing/features/features.h" |
| 84 #include "printing/print_settings.h" | 85 #include "printing/print_settings.h" |
| 85 #include "printing/printing_context.h" | 86 #include "printing/printing_context.h" |
| 86 #include "printing/units.h" | 87 #include "printing/units.h" |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 | 915 |
| 915 // Do this so the initiator can open a new print preview dialog, while the | 916 // Do this so the initiator can open a new print preview dialog, while the |
| 916 // current print preview dialog is still handling its print job. | 917 // current print preview dialog is still handling its print job. |
| 917 WebContents* initiator = GetInitiator(); | 918 WebContents* initiator = GetInitiator(); |
| 918 if (initiator) { | 919 if (initiator) { |
| 919 // Save initiator IDs. |PrintingMessageFilter::OnUpdatePrintSettings| | 920 // Save initiator IDs. |PrintingMessageFilter::OnUpdatePrintSettings| |
| 920 // would be called when initiator info is cleared. | 921 // would be called when initiator info is cleared. |
| 921 settings->SetInteger(printing::kPreviewInitiatorHostId, | 922 settings->SetInteger(printing::kPreviewInitiatorHostId, |
| 922 initiator->GetRenderProcessHost()->GetID()); | 923 initiator->GetRenderProcessHost()->GetID()); |
| 923 settings->SetInteger(printing::kPreviewInitiatorRoutingId, | 924 settings->SetInteger(printing::kPreviewInitiatorRoutingId, |
| 924 initiator->GetRoutingID()); | 925 initiator->GetRenderViewHost()->GetRoutingID()); |
| 925 } | 926 } |
| 926 | 927 |
| 927 ClearInitiatorDetails(); | 928 ClearInitiatorDetails(); |
| 928 | 929 |
| 929 // The PDF being printed contains only the pages that the user selected, | 930 // The PDF being printed contains only the pages that the user selected, |
| 930 // so ignore the page range and print all pages. | 931 // so ignore the page range and print all pages. |
| 931 settings->Remove(printing::kSettingPageRange, NULL); | 932 settings->Remove(printing::kSettingPageRange, NULL); |
| 932 // Reset selection only flag for the same reason. | 933 // Reset selection only flag for the same reason. |
| 933 settings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false); | 934 settings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false); |
| 934 | 935 |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 | 1698 |
| 1698 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { | 1699 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { |
| 1699 if (gaia_cookie_manager_service_) | 1700 if (gaia_cookie_manager_service_) |
| 1700 gaia_cookie_manager_service_->RemoveObserver(this); | 1701 gaia_cookie_manager_service_->RemoveObserver(this); |
| 1701 } | 1702 } |
| 1702 | 1703 |
| 1703 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1704 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
| 1704 const base::Closure& closure) { | 1705 const base::Closure& closure) { |
| 1705 pdf_file_saved_closure_ = closure; | 1706 pdf_file_saved_closure_ = closure; |
| 1706 } | 1707 } |
| OLD | NEW |