| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // Sampling rate (frequency) of the output stream. | 367 // Sampling rate (frequency) of the output stream. |
| 368 int sample_rate; | 368 int sample_rate; |
| 369 | 369 |
| 370 // Number of bits per sample; | 370 // Number of bits per sample; |
| 371 int bits_per_sample; | 371 int bits_per_sample; |
| 372 | 372 |
| 373 // Number of bytes per packet. | 373 // Number of bytes per packet. |
| 374 size_t packet_size; | 374 size_t packet_size; |
| 375 }; | 375 }; |
| 376 | 376 |
| 377 // This message is used for supporting popup menus on Mac OS X using native |
| 378 // Cocoa controls. The renderer sends us this message which we use to populate |
| 379 // the popup menu. |
| 380 struct ViewHostMsg_ShowPopup_Params { |
| 381 // Position on the screen. |
| 382 gfx::Rect bounds; |
| 383 |
| 384 // The height of each item in the menu. |
| 385 int item_height; |
| 386 |
| 387 // The currently selected (displayed) item in the menu. |
| 388 int selected_item; |
| 389 |
| 390 // The entire list of items in the popup menu. |
| 391 std::vector<WebMenuItem> popup_items; |
| 392 }; |
| 393 |
| 377 namespace IPC { | 394 namespace IPC { |
| 378 | 395 |
| 379 template <> | 396 template <> |
| 380 struct ParamTraits<ResourceType::Type> { | 397 struct ParamTraits<ResourceType::Type> { |
| 381 typedef ResourceType::Type param_type; | 398 typedef ResourceType::Type param_type; |
| 382 static void Write(Message* m, const param_type& p) { | 399 static void Write(Message* m, const param_type& p) { |
| 383 m->WriteInt(p); | 400 m->WriteInt(p); |
| 384 } | 401 } |
| 385 static bool Read(const Message* m, void** iter, param_type* p) { | 402 static bool Read(const Message* m, void** iter, param_type* p) { |
| 386 int type; | 403 int type; |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 break; | 1842 break; |
| 1826 default: | 1843 default: |
| 1827 state = L"UNKNOWN"; | 1844 state = L"UNKNOWN"; |
| 1828 break; | 1845 break; |
| 1829 } | 1846 } |
| 1830 | 1847 |
| 1831 LogParam(state, l); | 1848 LogParam(state, l); |
| 1832 } | 1849 } |
| 1833 }; | 1850 }; |
| 1834 | 1851 |
| 1852 template<> |
| 1853 struct ParamTraits<WebMenuItem::Type> { |
| 1854 typedef WebMenuItem::Type param_type; |
| 1855 static void Write(Message* m, const param_type& p) { |
| 1856 m->WriteInt(p); |
| 1857 } |
| 1858 static bool Read(const Message* m, void** iter, param_type* p) { |
| 1859 int type; |
| 1860 if (!m->ReadInt(iter, &type)) |
| 1861 return false; |
| 1862 *p = static_cast<WebMenuItem::Type>(type); |
| 1863 return true; |
| 1864 } |
| 1865 static void Log(const param_type& p, std::wstring* l) { |
| 1866 std::wstring type; |
| 1867 switch (p) { |
| 1868 case WebMenuItem::OPTION: |
| 1869 type = L"OPTION"; |
| 1870 break; |
| 1871 case WebMenuItem::GROUP: |
| 1872 type = L"GROUP"; |
| 1873 break; |
| 1874 case WebMenuItem::SEPARATOR: |
| 1875 type = L"SEPARATOR"; |
| 1876 break; |
| 1877 default: |
| 1878 type = L"UNKNOWN"; |
| 1879 break; |
| 1880 } |
| 1881 LogParam(type, l); |
| 1882 } |
| 1883 }; |
| 1884 |
| 1885 template<> |
| 1886 struct ParamTraits<WebMenuItem> { |
| 1887 typedef WebMenuItem param_type; |
| 1888 static void Write(Message* m, const param_type& p) { |
| 1889 WriteParam(m, p.label); |
| 1890 WriteParam(m, p.type); |
| 1891 WriteParam(m, p.enabled); |
| 1892 } |
| 1893 static bool Read(const Message* m, void** iter, param_type* p) { |
| 1894 return |
| 1895 ReadParam(m, iter, &p->label) && |
| 1896 ReadParam(m, iter, &p->type) && |
| 1897 ReadParam(m, iter, &p->enabled); |
| 1898 } |
| 1899 static void Log(const param_type& p, std::wstring* l) { |
| 1900 l->append(L"("); |
| 1901 LogParam(p.label, l); |
| 1902 l->append(L", "); |
| 1903 LogParam(p.type, l); |
| 1904 l->append(L", "); |
| 1905 LogParam(p.enabled, l); |
| 1906 l->append(L")"); |
| 1907 } |
| 1908 }; |
| 1909 |
| 1910 // Traits for ViewHostMsg_ShowPopup_Params. |
| 1911 template <> |
| 1912 struct ParamTraits<ViewHostMsg_ShowPopup_Params> { |
| 1913 typedef ViewHostMsg_ShowPopup_Params param_type; |
| 1914 static void Write(Message* m, const param_type& p) { |
| 1915 WriteParam(m, p.bounds); |
| 1916 WriteParam(m, p.item_height); |
| 1917 WriteParam(m, p.selected_item); |
| 1918 WriteParam(m, p.popup_items); |
| 1919 } |
| 1920 static bool Read(const Message* m, void** iter, param_type* p) { |
| 1921 return |
| 1922 ReadParam(m, iter, &p->bounds) && |
| 1923 ReadParam(m, iter, &p->item_height) && |
| 1924 ReadParam(m, iter, &p->selected_item) && |
| 1925 ReadParam(m, iter, &p->popup_items); |
| 1926 } |
| 1927 static void Log(const param_type& p, std::wstring* l) { |
| 1928 l->append(L"("); |
| 1929 LogParam(p.bounds, l); |
| 1930 l->append(L", "); |
| 1931 LogParam(p.item_height, l); |
| 1932 l->append(L", "); |
| 1933 LogParam(p.selected_item, l); |
| 1934 l->append(L", "); |
| 1935 LogParam(p.popup_items, l); |
| 1936 l->append(L")"); |
| 1937 } |
| 1938 }; |
| 1939 |
| 1835 } // namespace IPC | 1940 } // namespace IPC |
| 1836 | 1941 |
| 1837 | 1942 |
| 1838 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" | 1943 #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" |
| 1839 #include "chrome/common/ipc_message_macros.h" | 1944 #include "chrome/common/ipc_message_macros.h" |
| 1840 | 1945 |
| 1841 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ | 1946 #endif // CHROME_COMMON_RENDER_MESSAGES_H_ |
| OLD | NEW |