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

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

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos Created 8 years, 5 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 | Annotate | Revision Log
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 #include "chrome/browser/prefs/pref_service.h" 28 #include "chrome/browser/prefs/pref_service.h"
29 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" 29 #include "chrome/browser/printing/cloud_print/cloud_print_url.h"
30 #include "chrome/browser/printing/print_dialog_cloud.h" 30 #include "chrome/browser/printing/print_dialog_cloud.h"
31 #include "chrome/browser/printing/print_error_dialog.h" 31 #include "chrome/browser/printing/print_error_dialog.h"
32 #include "chrome/browser/printing/print_job_manager.h" 32 #include "chrome/browser/printing/print_job_manager.h"
33 #include "chrome/browser/printing/print_preview_tab_controller.h" 33 #include "chrome/browser/printing/print_preview_tab_controller.h"
34 #include "chrome/browser/printing/print_system_task_proxy.h" 34 #include "chrome/browser/printing/print_system_task_proxy.h"
35 #include "chrome/browser/printing/print_view_manager.h" 35 #include "chrome/browser/printing/print_view_manager.h"
36 #include "chrome/browser/printing/printer_manager_dialog.h" 36 #include "chrome/browser/printing/printer_manager_dialog.h"
37 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/ui/chrome_select_file_policy.h"
38 #include "chrome/browser/ui/tab_contents/tab_contents.h" 39 #include "chrome/browser/ui/tab_contents/tab_contents.h"
39 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 40 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
40 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" 41 #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
41 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
43 #include "chrome/common/print_messages.h" 44 #include "chrome/common/print_messages.h"
44 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
45 #include "content/public/browser/navigation_controller.h" 46 #include "content/public/browser/navigation_controller.h"
46 #include "content/public/browser/navigation_entry.h" 47 #include "content/public/browser/navigation_entry.h"
47 #include "content/public/browser/render_view_host.h" 48 #include "content/public/browser/render_view_host.h"
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 if (!GetStickySettings()->save_path()) { 829 if (!GetStickySettings()->save_path()) {
829 // Allowing IO operation temporarily. It is ok to do so here because 830 // Allowing IO operation temporarily. It is ok to do so here because
830 // the select file dialog performs IO anyway in order to display the 831 // the select file dialog performs IO anyway in order to display the
831 // folders and also it is modal. 832 // folders and also it is modal.
832 base::ThreadRestrictions::ScopedAllowIO allow_io; 833 base::ThreadRestrictions::ScopedAllowIO allow_io;
833 FilePath file_path; 834 FilePath file_path;
834 PathService::Get(chrome::DIR_USER_DOCUMENTS, &file_path); 835 PathService::Get(chrome::DIR_USER_DOCUMENTS, &file_path);
835 GetStickySettings()->StoreSavePath(file_path); 836 GetStickySettings()->StoreSavePath(file_path);
836 } 837 }
837 838
838 if (!select_file_dialog_.get()) 839 select_file_dialog_ = SelectFileDialog::Create(
839 select_file_dialog_ = SelectFileDialog::Create(this); 840 this, new ChromeSelectFilePolicy(preview_web_contents())),
840
841 select_file_dialog_->SelectFile( 841 select_file_dialog_->SelectFile(
842 SelectFileDialog::SELECT_SAVEAS_FILE, 842 SelectFileDialog::SELECT_SAVEAS_FILE,
843 string16(), 843 string16(),
844 GetStickySettings()->save_path()->Append(default_filename), 844 GetStickySettings()->save_path()->Append(default_filename),
845 &file_type_info, 845 &file_type_info,
846 0, 846 0,
847 FILE_PATH_LITERAL(""), 847 FILE_PATH_LITERAL(""),
848 preview_web_contents(),
849 platform_util::GetTopLevel(preview_web_contents()->GetNativeView()), 848 platform_util::GetTopLevel(preview_web_contents()->GetNativeView()),
850 NULL); 849 NULL);
851 } 850 }
852 851
853 void PrintPreviewHandler::OnTabDestroyed() { 852 void PrintPreviewHandler::OnTabDestroyed() {
854 TabContents* initiator_tab = GetInitiatorTab(); 853 TabContents* initiator_tab = GetInitiatorTab();
855 if (!initiator_tab) 854 if (!initiator_tab)
856 return; 855 return;
857 856
858 initiator_tab->print_view_manager()->set_observer(NULL); 857 initiator_tab->print_view_manager()->set_observer(NULL);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 return; 910 return;
912 911
913 // We no longer require the initiator tab details. Remove those details 912 // We no longer require the initiator tab details. Remove those details
914 // associated with the preview tab to allow the initiator tab to create 913 // associated with the preview tab to allow the initiator tab to create
915 // another preview tab. 914 // another preview tab.
916 printing::PrintPreviewTabController* tab_controller = 915 printing::PrintPreviewTabController* tab_controller =
917 printing::PrintPreviewTabController::GetInstance(); 916 printing::PrintPreviewTabController::GetInstance();
918 if (tab_controller) 917 if (tab_controller)
919 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); 918 tab_controller->EraseInitiatorTabInfo(preview_tab_contents());
920 } 919 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698