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

Side by Side Diff: chrome/browser/ui/webui/print_preview_handler.h

Issue 6759044: Prepopulating "Print To PDF" select file dialog with a suggested filename and path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/ui/shell_dialogs.h" 11 #include "chrome/browser/ui/shell_dialogs.h"
12 #include "content/browser/webui/web_ui.h" 12 #include "content/browser/webui/web_ui.h"
13 13
14 class EnumeratePrintersTaskProxy; 14 class EnumeratePrintersTaskProxy;
15 class FilePath;
15 class FundamentalValue; 16 class FundamentalValue;
16 17
17 namespace printing { 18 namespace printing {
18 class PrintBackend; 19 class PrintBackend;
19 } 20 }
20 21
21 // The handler for Javascript messages related to the "print preview" dialog. 22 // The handler for Javascript messages related to the "print preview" dialog.
22 class PrintPreviewHandler : public WebUIMessageHandler, 23 class PrintPreviewHandler : public WebUIMessageHandler,
23 public base::SupportsWeakPtr<PrintPreviewHandler>, 24 public base::SupportsWeakPtr<PrintPreviewHandler>,
24 public SelectFileDialog::Listener { 25 public SelectFileDialog::Listener {
25 public: 26 public:
26 PrintPreviewHandler(); 27 PrintPreviewHandler();
27 virtual ~PrintPreviewHandler(); 28 virtual ~PrintPreviewHandler();
28 29
29 // WebUIMessageHandler implementation. 30 // WebUIMessageHandler implementation.
30 virtual void RegisterMessages(); 31 virtual void RegisterMessages();
31 32
32 // SelectFileDialog::Listener implementation. 33 // SelectFileDialog::Listener implementation.
33 virtual void FileSelected(const FilePath& path, int index, void* params); 34 virtual void FileSelected(const FilePath& path, int index, void* params);
34 35
35 // Displays a modal dialog, prompting the user to select a file. 36 // Displays a modal dialog, prompting the user to select a file.
36 void SelectFile(); 37 void SelectFile(const FilePath& default_path);
37 38
38 private: 39 private:
39 friend class EnumeratePrintersTaskProxy; 40 friend class EnumeratePrintersTaskProxy;
40 41
41 // Get the list of printers. |args| is unused. 42 // Get the list of printers. |args| is unused.
42 void HandleGetPrinters(const ListValue* args); 43 void HandleGetPrinters(const ListValue* args);
43 44
44 // Ask the initiator renderer to generate a preview. 45 // Ask the initiator renderer to generate a preview.
45 // First element of |args| is a job settings JSON string. 46 // First element of |args| is a job settings JSON string.
46 void HandleGetPreview(const ListValue* args); 47 void HandleGetPreview(const ListValue* args);
(...skipping 20 matching lines...) Expand all
67 68
68 // Set to true if the preview should be in color. 69 // Set to true if the preview should be in color.
69 bool color_; 70 bool color_;
70 71
71 // Set to true if the preview should be landscape. 72 // Set to true if the preview should be landscape.
72 bool landscape_; 73 bool landscape_;
73 74
74 // The underlying dialog object. 75 // The underlying dialog object.
75 scoped_refptr<SelectFileDialog> select_file_dialog_; 76 scoped_refptr<SelectFileDialog> select_file_dialog_;
76 77
78 static FilePath* last_saved_path_;
79
77 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); 80 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler);
78 }; 81 };
79 82
80 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_ 83 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698