| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 contents(match.contents), | 41 contents(match.contents), |
| 42 description(match.description), | 42 description(match.description), |
| 43 is_history_what_you_typed_match(match.is_history_what_you_typed_match), | 43 is_history_what_you_typed_match(match.is_history_what_you_typed_match), |
| 44 type(AutocompleteMatch::TypeToString(match.type)), | 44 type(AutocompleteMatch::TypeToString(match.type)), |
| 45 starred(match.starred) { | 45 starred(match.starred) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 std::string provider_name; | 48 std::string provider_name; |
| 49 int relevance; | 49 int relevance; |
| 50 bool deletable; | 50 bool deletable; |
| 51 std::wstring fill_into_edit; | 51 string16 fill_into_edit; |
| 52 size_t inline_autocomplete_offset; | 52 size_t inline_autocomplete_offset; |
| 53 GURL destination_url; | 53 GURL destination_url; |
| 54 std::wstring contents; | 54 string16 contents; |
| 55 std::wstring description; | 55 string16 description; |
| 56 bool is_history_what_you_typed_match; | 56 bool is_history_what_you_typed_match; |
| 57 std::string type; | 57 std::string type; |
| 58 bool starred; | 58 bool starred; |
| 59 }; | 59 }; |
| 60 typedef std::vector<AutocompleteMatchData> Matches; | 60 typedef std::vector<AutocompleteMatchData> Matches; |
| 61 | 61 |
| 62 namespace IPC { | 62 namespace IPC { |
| 63 | 63 |
| 64 template <> | 64 template <> |
| 65 struct ParamTraits<AutocompleteMatchData> { | 65 struct ParamTraits<AutocompleteMatchData> { |
| 66 typedef AutocompleteMatchData param_type; | 66 typedef AutocompleteMatchData param_type; |
| 67 static void Write(Message* m, const param_type& p) { | 67 static void Write(Message* m, const param_type& p) { |
| 68 m->WriteString(p.provider_name); | 68 m->WriteString(p.provider_name); |
| 69 m->WriteInt(p.relevance); | 69 m->WriteInt(p.relevance); |
| 70 m->WriteBool(p.deletable); | 70 m->WriteBool(p.deletable); |
| 71 m->WriteWString(p.fill_into_edit); | 71 m->WriteString16(p.fill_into_edit); |
| 72 m->WriteSize(p.inline_autocomplete_offset); | 72 m->WriteSize(p.inline_autocomplete_offset); |
| 73 m->WriteString(p.destination_url.possibly_invalid_spec()); | 73 m->WriteString(p.destination_url.possibly_invalid_spec()); |
| 74 m->WriteWString(p.contents); | 74 m->WriteString16(p.contents); |
| 75 m->WriteWString(p.description); | 75 m->WriteString16(p.description); |
| 76 m->WriteBool(p.is_history_what_you_typed_match); | 76 m->WriteBool(p.is_history_what_you_typed_match); |
| 77 m->WriteString(p.type); | 77 m->WriteString(p.type); |
| 78 m->WriteBool(p.starred); | 78 m->WriteBool(p.starred); |
| 79 } | 79 } |
| 80 | 80 |
| 81 static bool Read(const Message* m, void** iter, param_type* r) { | 81 static bool Read(const Message* m, void** iter, param_type* r) { |
| 82 std::string destination_url; | 82 std::string destination_url; |
| 83 if (!m->ReadString(iter, &r->provider_name) || | 83 if (!m->ReadString(iter, &r->provider_name) || |
| 84 !m->ReadInt(iter, &r->relevance) || | 84 !m->ReadInt(iter, &r->relevance) || |
| 85 !m->ReadBool(iter, &r->deletable) || | 85 !m->ReadBool(iter, &r->deletable) || |
| 86 !m->ReadWString(iter, &r->fill_into_edit) || | 86 !m->ReadString16(iter, &r->fill_into_edit) || |
| 87 !m->ReadSize(iter, &r->inline_autocomplete_offset) || | 87 !m->ReadSize(iter, &r->inline_autocomplete_offset) || |
| 88 !m->ReadString(iter, &destination_url) || | 88 !m->ReadString(iter, &destination_url) || |
| 89 !m->ReadWString(iter, &r->contents) || | 89 !m->ReadString16(iter, &r->contents) || |
| 90 !m->ReadWString(iter, &r->description) || | 90 !m->ReadString16(iter, &r->description) || |
| 91 !m->ReadBool(iter, &r->is_history_what_you_typed_match) || | 91 !m->ReadBool(iter, &r->is_history_what_you_typed_match) || |
| 92 !m->ReadString(iter, &r->type) || | 92 !m->ReadString(iter, &r->type) || |
| 93 !m->ReadBool(iter, &r->starred)) | 93 !m->ReadBool(iter, &r->starred)) |
| 94 return false; | 94 return false; |
| 95 r->destination_url = GURL(destination_url); | 95 r->destination_url = GURL(destination_url); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 static void Log(const param_type& p, std::string* l) { | 99 static void Log(const param_type& p, std::string* l) { |
| 100 l->append("["); | 100 l->append("["); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 129 AutocompleteEditProxy(AutomationMessageSender* sender, | 129 AutocompleteEditProxy(AutomationMessageSender* sender, |
| 130 AutomationHandleTracker* tracker, | 130 AutomationHandleTracker* tracker, |
| 131 int handle) | 131 int handle) |
| 132 : AutomationResourceProxy(tracker, sender, handle) {} | 132 : AutomationResourceProxy(tracker, sender, handle) {} |
| 133 virtual ~AutocompleteEditProxy() {} | 133 virtual ~AutocompleteEditProxy() {} |
| 134 | 134 |
| 135 // All these functions return true if the autocomplete edit is valid and | 135 // All these functions return true if the autocomplete edit is valid and |
| 136 // there are no IPC errors. | 136 // there are no IPC errors. |
| 137 | 137 |
| 138 // Gets the text visible in the omnibox. | 138 // Gets the text visible in the omnibox. |
| 139 bool GetText(std::wstring* text) const; | 139 bool GetText(string16* text) const; |
| 140 | 140 |
| 141 // Sets the text visible in the omnibox. | 141 // Sets the text visible in the omnibox. |
| 142 bool SetText(const std::wstring& text); | 142 bool SetText(const string16& text); |
| 143 | 143 |
| 144 // Determines if a query to an autocomplete provider is still in progress. | 144 // Determines if a query to an autocomplete provider is still in progress. |
| 145 // NOTE: No autocomplete queries will be made if the omnibox doesn't have | 145 // NOTE: No autocomplete queries will be made if the omnibox doesn't have |
| 146 // focus. This can be achieved by sending a IDC_FOCUS_LOCATION accelerator | 146 // focus. This can be achieved by sending a IDC_FOCUS_LOCATION accelerator |
| 147 // to the browser. | 147 // to the browser. |
| 148 bool IsQueryInProgress(bool* query_in_progress) const; | 148 bool IsQueryInProgress(bool* query_in_progress) const; |
| 149 | 149 |
| 150 // Gets a list of autocomplete matches that have been gathered so far. | 150 // Gets a list of autocomplete matches that have been gathered so far. |
| 151 bool GetAutocompleteMatches(Matches* matches) const; | 151 bool GetAutocompleteMatches(Matches* matches) const; |
| 152 | 152 |
| 153 // Waits for the autocomplete edit to receive focus. | 153 // Waits for the autocomplete edit to receive focus. |
| 154 bool WaitForFocus() const; | 154 bool WaitForFocus() const; |
| 155 | 155 |
| 156 // Waits for all queries to autocomplete providers to complete. | 156 // Waits for all queries to autocomplete providers to complete. |
| 157 // |wait_timeout_ms| gives the number of milliseconds to wait for the query | 157 // |wait_timeout_ms| gives the number of milliseconds to wait for the query |
| 158 // to finish. Returns false if IPC call failed or if the function times out. | 158 // to finish. Returns false if IPC call failed or if the function times out. |
| 159 bool WaitForQuery(int wait_timeout_ms) const; | 159 bool WaitForQuery(int wait_timeout_ms) const; |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditProxy); | 162 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditProxy); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 #endif // CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H_ | 165 #endif // CHROME_TEST_AUTOMATION_AUTOCOMPLETE_EDIT_PROXY_H_ |
| OLD | NEW |