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_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ | 5 #ifndef CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ |
6 #define CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ | 6 #define CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 size_t inline_autocomplete_offset; | 42 size_t inline_autocomplete_offset; |
43 GURL destination_url; | 43 GURL destination_url; |
44 std::wstring contents; | 44 std::wstring contents; |
45 std::wstring description; | 45 std::wstring description; |
46 bool is_history_what_you_typed_match; | 46 bool is_history_what_you_typed_match; |
47 std::string type; | 47 std::string type; |
48 bool starred; | 48 bool starred; |
49 }; | 49 }; |
50 typedef std::vector<AutocompleteMatchData> Matches; | 50 typedef std::vector<AutocompleteMatchData> Matches; |
51 | 51 |
| 52 namespace IPC { |
| 53 |
52 template <> | 54 template <> |
53 struct ParamTraits<AutocompleteMatchData> { | 55 struct ParamTraits<AutocompleteMatchData> { |
54 typedef AutocompleteMatchData param_type; | 56 typedef AutocompleteMatchData param_type; |
55 static void Write(IPC::Message* m, const param_type& p) { | 57 static void Write(Message* m, const param_type& p) { |
56 m->WriteString(p.provider_name); | 58 m->WriteString(p.provider_name); |
57 m->WriteInt(p.relevance); | 59 m->WriteInt(p.relevance); |
58 m->WriteBool(p.deletable); | 60 m->WriteBool(p.deletable); |
59 m->WriteWString(p.fill_into_edit); | 61 m->WriteWString(p.fill_into_edit); |
60 m->WriteSize(p.inline_autocomplete_offset); | 62 m->WriteSize(p.inline_autocomplete_offset); |
61 m->WriteString(p.destination_url.possibly_invalid_spec()); | 63 m->WriteString(p.destination_url.possibly_invalid_spec()); |
62 m->WriteWString(p.contents); | 64 m->WriteWString(p.contents); |
63 m->WriteWString(p.description); | 65 m->WriteWString(p.description); |
64 m->WriteBool(p.is_history_what_you_typed_match); | 66 m->WriteBool(p.is_history_what_you_typed_match); |
65 m->WriteString(p.type); | 67 m->WriteString(p.type); |
66 m->WriteBool(p.starred); | 68 m->WriteBool(p.starred); |
67 } | 69 } |
68 | 70 |
69 static bool Read(const IPC::Message* m, void** iter, param_type* r) { | 71 static bool Read(const Message* m, void** iter, param_type* r) { |
70 std::string destination_url; | 72 std::string destination_url; |
71 if (!m->ReadString(iter, &r->provider_name) || | 73 if (!m->ReadString(iter, &r->provider_name) || |
72 !m->ReadInt(iter, &r->relevance) || | 74 !m->ReadInt(iter, &r->relevance) || |
73 !m->ReadBool(iter, &r->deletable) || | 75 !m->ReadBool(iter, &r->deletable) || |
74 !m->ReadWString(iter, &r->fill_into_edit) || | 76 !m->ReadWString(iter, &r->fill_into_edit) || |
75 !m->ReadSize(iter, &r->inline_autocomplete_offset) || | 77 !m->ReadSize(iter, &r->inline_autocomplete_offset) || |
76 !m->ReadString(iter, &destination_url) || | 78 !m->ReadString(iter, &destination_url) || |
77 !m->ReadWString(iter, &r->contents) || | 79 !m->ReadWString(iter, &r->contents) || |
78 !m->ReadWString(iter, &r->description) || | 80 !m->ReadWString(iter, &r->description) || |
79 !m->ReadBool(iter, &r->is_history_what_you_typed_match) || | 81 !m->ReadBool(iter, &r->is_history_what_you_typed_match) || |
(...skipping 23 matching lines...) Expand all Loading... |
103 l->append(p.description); | 105 l->append(p.description); |
104 l->append(L" "); | 106 l->append(L" "); |
105 l->append(p.is_history_what_you_typed_match ? L"true" : L"false"); | 107 l->append(p.is_history_what_you_typed_match ? L"true" : L"false"); |
106 l->append(L" "); | 108 l->append(L" "); |
107 l->append(UTF8ToWide(p.type)); | 109 l->append(UTF8ToWide(p.type)); |
108 l->append(L" "); | 110 l->append(L" "); |
109 l->append(p.starred ? L"true" : L"false"); | 111 l->append(p.starred ? L"true" : L"false"); |
110 l->append(L"]"); | 112 l->append(L"]"); |
111 } | 113 } |
112 }; | 114 }; |
| 115 } // namespace IPC |
113 | 116 |
114 class AutocompleteEditProxy : public AutomationResourceProxy { | 117 class AutocompleteEditProxy : public AutomationResourceProxy { |
115 public: | 118 public: |
116 AutocompleteEditProxy(AutomationMessageSender* sender, | 119 AutocompleteEditProxy(AutomationMessageSender* sender, |
117 AutomationHandleTracker* tracker, | 120 AutomationHandleTracker* tracker, |
118 int handle) | 121 int handle) |
119 : AutomationResourceProxy(tracker, sender, handle) {} | 122 : AutomationResourceProxy(tracker, sender, handle) {} |
120 virtual ~AutocompleteEditProxy() {} | 123 virtual ~AutocompleteEditProxy() {} |
121 | 124 |
122 // All these functions return true if the autocomplete edit is valid and | 125 // All these functions return true if the autocomplete edit is valid and |
(...skipping 19 matching lines...) Expand all Loading... |
142 // to finish. Returns false if IPC call failed or if the function times out. | 145 // to finish. Returns false if IPC call failed or if the function times out. |
143 bool WaitForQuery(int wait_timeout_ms) const; | 146 bool WaitForQuery(int wait_timeout_ms) const; |
144 | 147 |
145 private: | 148 private: |
146 DISALLOW_EVIL_CONSTRUCTORS(AutocompleteEditProxy); | 149 DISALLOW_EVIL_CONSTRUCTORS(AutocompleteEditProxy); |
147 }; | 150 }; |
148 | 151 |
149 #endif // #define CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ | 152 #endif // #define CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H__ |
150 | 153 |
151 | 154 |
OLD | NEW |