OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <map> | 10 #include <map> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 namespace base { | 62 namespace base { |
63 class Time; | 63 class Time; |
64 } | 64 } |
65 | 65 |
66 class SkBitmap; | 66 class SkBitmap; |
67 | 67 |
68 // Parameters structure for ViewMsg_Navigate, which has too many data | 68 // Parameters structure for ViewMsg_Navigate, which has too many data |
69 // parameters to be reasonably put in a predefined IPC message. | 69 // parameters to be reasonably put in a predefined IPC message. |
70 struct ViewMsg_Navigate_Params { | 70 struct ViewMsg_Navigate_Params { |
| 71 enum NavigationType { |
| 72 // Reload the page. |
| 73 RELOAD, |
| 74 |
| 75 // The navigation is the result of session restore and should honor the |
| 76 // page's cache policy while restoring form state. This is set to true if |
| 77 // restoring a tab/session from the previous session and the previous |
| 78 // session did not crash. If this is not set and the page was restored then |
| 79 // the page's cache policy is ignored and we load from the cache. |
| 80 RESTORE, |
| 81 |
| 82 // Navigation type not categorized by the other types. |
| 83 NORMAL |
| 84 }; |
| 85 |
71 // The page_id for this navigation, or -1 if it is a new navigation. Back, | 86 // The page_id for this navigation, or -1 if it is a new navigation. Back, |
72 // Forward, and Reload navigations should have a valid page_id. If the load | 87 // Forward, and Reload navigations should have a valid page_id. If the load |
73 // succeeds, then this page_id will be reflected in the resultant | 88 // succeeds, then this page_id will be reflected in the resultant |
74 // ViewHostMsg_FrameNavigate message. | 89 // ViewHostMsg_FrameNavigate message. |
75 int32 page_id; | 90 int32 page_id; |
76 | 91 |
77 // The URL to load. | 92 // The URL to load. |
78 GURL url; | 93 GURL url; |
79 | 94 |
80 // The URL to send in the "Referer" header field. Can be empty if there is | 95 // The URL to send in the "Referer" header field. Can be empty if there is |
81 // no referrer. | 96 // no referrer. |
82 GURL referrer; | 97 GURL referrer; |
83 | 98 |
84 // The type of transition. | 99 // The type of transition. |
85 PageTransition::Type transition; | 100 PageTransition::Type transition; |
86 | 101 |
87 // Opaque history state (received by ViewHostMsg_UpdateState). | 102 // Opaque history state (received by ViewHostMsg_UpdateState). |
88 std::string state; | 103 std::string state; |
89 | 104 |
90 // Specifies if the URL should be loaded using 'reload' semantics (i.e., | 105 // Type of navigation. |
91 // bypassing any locally cached content). | 106 NavigationType navigation_type; |
92 bool reload; | |
93 | 107 |
94 // The time the request was created | 108 // The time the request was created |
95 base::Time request_time; | 109 base::Time request_time; |
96 }; | 110 }; |
97 | 111 |
98 // Current status of the audio output stream in the browser process. Browser | 112 // Current status of the audio output stream in the browser process. Browser |
99 // sends information about the current playback state and error to the | 113 // sends information about the current playback state and error to the |
100 // renderer process using this type. | 114 // renderer process using this type. |
101 struct ViewMsg_AudioStreamState { | 115 struct ViewMsg_AudioStreamState { |
102 enum State { | 116 enum State { |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // Traits for ViewMsg_Navigate_Params structure to pack/unpack. | 672 // Traits for ViewMsg_Navigate_Params structure to pack/unpack. |
659 template <> | 673 template <> |
660 struct ParamTraits<ViewMsg_Navigate_Params> { | 674 struct ParamTraits<ViewMsg_Navigate_Params> { |
661 typedef ViewMsg_Navigate_Params param_type; | 675 typedef ViewMsg_Navigate_Params param_type; |
662 static void Write(Message* m, const param_type& p) { | 676 static void Write(Message* m, const param_type& p) { |
663 WriteParam(m, p.page_id); | 677 WriteParam(m, p.page_id); |
664 WriteParam(m, p.url); | 678 WriteParam(m, p.url); |
665 WriteParam(m, p.referrer); | 679 WriteParam(m, p.referrer); |
666 WriteParam(m, p.transition); | 680 WriteParam(m, p.transition); |
667 WriteParam(m, p.state); | 681 WriteParam(m, p.state); |
668 WriteParam(m, p.reload); | 682 WriteParam(m, p.navigation_type); |
669 WriteParam(m, p.request_time); | 683 WriteParam(m, p.request_time); |
670 } | 684 } |
671 static bool Read(const Message* m, void** iter, param_type* p) { | 685 static bool Read(const Message* m, void** iter, param_type* p) { |
672 return | 686 return |
673 ReadParam(m, iter, &p->page_id) && | 687 ReadParam(m, iter, &p->page_id) && |
674 ReadParam(m, iter, &p->url) && | 688 ReadParam(m, iter, &p->url) && |
675 ReadParam(m, iter, &p->referrer) && | 689 ReadParam(m, iter, &p->referrer) && |
676 ReadParam(m, iter, &p->transition) && | 690 ReadParam(m, iter, &p->transition) && |
677 ReadParam(m, iter, &p->state) && | 691 ReadParam(m, iter, &p->state) && |
678 ReadParam(m, iter, &p->reload) && | 692 ReadParam(m, iter, &p->navigation_type) && |
679 ReadParam(m, iter, &p->request_time); | 693 ReadParam(m, iter, &p->request_time); |
680 } | 694 } |
681 static void Log(const param_type& p, std::wstring* l) { | 695 static void Log(const param_type& p, std::wstring* l) { |
682 l->append(L"("); | 696 l->append(L"("); |
683 LogParam(p.page_id, l); | 697 LogParam(p.page_id, l); |
684 l->append(L", "); | 698 l->append(L", "); |
685 LogParam(p.url, l); | 699 LogParam(p.url, l); |
686 l->append(L", "); | 700 l->append(L", "); |
687 LogParam(p.transition, l); | 701 LogParam(p.transition, l); |
688 l->append(L", "); | 702 l->append(L", "); |
689 LogParam(p.state, l); | 703 LogParam(p.state, l); |
690 l->append(L", "); | 704 l->append(L", "); |
691 LogParam(p.reload, l); | 705 LogParam(p.navigation_type, l); |
692 l->append(L", "); | 706 l->append(L", "); |
693 LogParam(p.request_time, l); | 707 LogParam(p.request_time, l); |
694 l->append(L")"); | 708 l->append(L")"); |
695 } | 709 } |
696 }; | 710 }; |
697 | 711 |
| 712 template<> |
| 713 struct ParamTraits<ViewMsg_Navigate_Params::NavigationType> { |
| 714 typedef ViewMsg_Navigate_Params::NavigationType param_type; |
| 715 static void Write(Message* m, const param_type& p) { |
| 716 m->WriteInt(p); |
| 717 } |
| 718 static bool Read(const Message* m, void** iter, param_type* p) { |
| 719 int type; |
| 720 if (!m->ReadInt(iter, &type)) |
| 721 return false; |
| 722 *p = static_cast<ViewMsg_Navigate_Params::NavigationType>(type); |
| 723 return true; |
| 724 } |
| 725 static void Log(const param_type& p, std::wstring* l) { |
| 726 std::wstring event; |
| 727 switch (p) { |
| 728 case ViewMsg_Navigate_Params::RELOAD: |
| 729 event = L"NavigationType_RELOAD"; |
| 730 break; |
| 731 |
| 732 case ViewMsg_Navigate_Params::RESTORE: |
| 733 event = L"NavigationType_RESTORE"; |
| 734 break; |
| 735 |
| 736 case ViewMsg_Navigate_Params::NORMAL: |
| 737 event = L"NavigationType_NORMAL"; |
| 738 break; |
| 739 |
| 740 default: |
| 741 event = L"NavigationType_UNKNOWN"; |
| 742 break; |
| 743 } |
| 744 LogParam(event, l); |
| 745 } |
| 746 }; |
| 747 |
698 // Traits for PasswordForm_Params structure to pack/unpack. | 748 // Traits for PasswordForm_Params structure to pack/unpack. |
699 template <> | 749 template <> |
700 struct ParamTraits<webkit_glue::PasswordForm> { | 750 struct ParamTraits<webkit_glue::PasswordForm> { |
701 typedef webkit_glue::PasswordForm param_type; | 751 typedef webkit_glue::PasswordForm param_type; |
702 static void Write(Message* m, const param_type& p) { | 752 static void Write(Message* m, const param_type& p) { |
703 WriteParam(m, p.signon_realm); | 753 WriteParam(m, p.signon_realm); |
704 WriteParam(m, p.origin); | 754 WriteParam(m, p.origin); |
705 WriteParam(m, p.action); | 755 WriteParam(m, p.action); |
706 WriteParam(m, p.submit_element); | 756 WriteParam(m, p.submit_element); |
707 WriteParam(m, p.username_element); | 757 WriteParam(m, p.username_element); |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 } | 2205 } |
2156 }; | 2206 }; |
2157 | 2207 |
2158 } // namespace IPC | 2208 } // namespace IPC |
2159 | 2209 |
2160 | 2210 |
2161 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 2211 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
2162 #include "ipc/ipc_message_macros.h" | 2212 #include "ipc/ipc_message_macros.h" |
2163 | 2213 |
2164 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 2214 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
OLD | NEW |