OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COMMON_RENDER_MESSAGES_H_ | 5 #ifndef CHROME_COMMON_RENDER_MESSAGES_H_ |
6 #define CHROME_COMMON_RENDER_MESSAGES_H_ | 6 #define CHROME_COMMON_RENDER_MESSAGES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 }; | 816 }; |
817 | 817 |
818 struct ViewHostMsg_RunFileChooser_Params { | 818 struct ViewHostMsg_RunFileChooser_Params { |
819 enum Mode { | 819 enum Mode { |
820 // Requires that the file exists before allowing the user to pick it. | 820 // Requires that the file exists before allowing the user to pick it. |
821 Open, | 821 Open, |
822 | 822 |
823 // Like Open, but allows picking multiple files to open. | 823 // Like Open, but allows picking multiple files to open. |
824 OpenMultiple, | 824 OpenMultiple, |
825 | 825 |
| 826 // Like Open, but selects a folder. |
| 827 OpenFolder, |
| 828 |
826 // Allows picking a nonexistent file, and prompts to overwrite if the file | 829 // Allows picking a nonexistent file, and prompts to overwrite if the file |
827 // already exists. | 830 // already exists. |
828 Save, | 831 Save, |
829 }; | 832 }; |
830 | 833 |
831 Mode mode; | 834 Mode mode; |
832 | 835 |
833 // Title to be used for the dialog. This may be empty for the default title, | 836 // Title to be used for the dialog. This may be empty for the default title, |
834 // which will be either "Open" or "Save" depending on the mode. | 837 // which will be either "Open" or "Save" depending on the mode. |
835 string16 title; | 838 string16 title; |
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 WriteParam(m, static_cast<int>(p.mode)); | 2563 WriteParam(m, static_cast<int>(p.mode)); |
2561 WriteParam(m, p.title); | 2564 WriteParam(m, p.title); |
2562 WriteParam(m, p.default_file_name); | 2565 WriteParam(m, p.default_file_name); |
2563 } | 2566 } |
2564 static bool Read(const Message* m, void** iter, param_type* p) { | 2567 static bool Read(const Message* m, void** iter, param_type* p) { |
2565 int mode; | 2568 int mode; |
2566 if (!ReadParam(m, iter, &mode)) | 2569 if (!ReadParam(m, iter, &mode)) |
2567 return false; | 2570 return false; |
2568 if (mode != param_type::Open && | 2571 if (mode != param_type::Open && |
2569 mode != param_type::OpenMultiple && | 2572 mode != param_type::OpenMultiple && |
| 2573 mode != param_type::OpenFolder && |
2570 mode != param_type::Save) | 2574 mode != param_type::Save) |
2571 return false; | 2575 return false; |
2572 p->mode = static_cast<param_type::Mode>(mode); | 2576 p->mode = static_cast<param_type::Mode>(mode); |
2573 return | 2577 return |
2574 ReadParam(m, iter, &p->title) && | 2578 ReadParam(m, iter, &p->title) && |
2575 ReadParam(m, iter, &p->default_file_name); | 2579 ReadParam(m, iter, &p->default_file_name); |
2576 }; | 2580 }; |
2577 static void Log(const param_type& p, std::string* l) { | 2581 static void Log(const param_type& p, std::string* l) { |
2578 switch (p.mode) { | 2582 switch (p.mode) { |
2579 case param_type::Open: | 2583 case param_type::Open: |
2580 l->append("(Open, "); | 2584 l->append("(Open, "); |
2581 break; | 2585 break; |
2582 case param_type::OpenMultiple: | 2586 case param_type::OpenMultiple: |
2583 l->append("(OpenMultiple, "); | 2587 l->append("(OpenMultiple, "); |
2584 break; | 2588 break; |
| 2589 case param_type::OpenFolder: |
| 2590 l->append("(OpenFolder, "); |
| 2591 break; |
2585 case param_type::Save: | 2592 case param_type::Save: |
2586 l->append("(Save, "); | 2593 l->append("(Save, "); |
2587 break; | 2594 break; |
2588 default: | 2595 default: |
2589 l->append("(UNKNOWN, "); | 2596 l->append("(UNKNOWN, "); |
2590 } | 2597 } |
2591 LogParam(p.title, l); | 2598 LogParam(p.title, l); |
2592 l->append(", "); | 2599 l->append(", "); |
2593 LogParam(p.default_file_name, l); | 2600 LogParam(p.default_file_name, l); |
2594 } | 2601 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 l->append(")"); | 2827 l->append(")"); |
2821 } | 2828 } |
2822 }; | 2829 }; |
2823 | 2830 |
2824 } // namespace IPC | 2831 } // namespace IPC |
2825 | 2832 |
2826 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 2833 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
2827 #include "ipc/ipc_message_macros.h" | 2834 #include "ipc/ipc_message_macros.h" |
2828 | 2835 |
2829 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 2836 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
OLD | NEW |