OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 if (browser_tracker_->ContainsHandle(handle)) { | 1008 if (browser_tracker_->ContainsHandle(handle)) { |
1009 Browser* browser = browser_tracker_->GetResource(handle); | 1009 Browser* browser = browser_tracker_->GetResource(handle); |
1010 if (browser) | 1010 if (browser) |
1011 *visible = browser->window()->IsFullscreenBubbleVisible(); | 1011 *visible = browser->window()->IsFullscreenBubbleVisible(); |
1012 } | 1012 } |
1013 } | 1013 } |
1014 | 1014 |
1015 void TestingAutomationProvider::GetAutocompleteEditText( | 1015 void TestingAutomationProvider::GetAutocompleteEditText( |
1016 int autocomplete_edit_handle, | 1016 int autocomplete_edit_handle, |
1017 bool* success, | 1017 bool* success, |
1018 std::wstring* text) { | 1018 string16* text) { |
1019 *success = false; | 1019 *success = false; |
1020 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { | 1020 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { |
1021 *text = autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> | 1021 *text = autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> |
1022 GetText(); | 1022 GetText(); |
1023 *success = true; | 1023 *success = true; |
1024 } | 1024 } |
1025 } | 1025 } |
1026 | 1026 |
1027 void TestingAutomationProvider::SetAutocompleteEditText( | 1027 void TestingAutomationProvider::SetAutocompleteEditText( |
1028 int autocomplete_edit_handle, | 1028 int autocomplete_edit_handle, |
1029 const std::wstring& text, | 1029 const string16& text, |
1030 bool* success) { | 1030 bool* success) { |
1031 *success = false; | 1031 *success = false; |
1032 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { | 1032 if (autocomplete_edit_tracker_->ContainsHandle(autocomplete_edit_handle)) { |
1033 autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> | 1033 autocomplete_edit_tracker_->GetResource(autocomplete_edit_handle)-> |
1034 SetUserText(text); | 1034 SetUserText(text); |
1035 *success = true; | 1035 *success = true; |
1036 } | 1036 } |
1037 } | 1037 } |
1038 | 1038 |
1039 void TestingAutomationProvider::AutocompleteEditGetMatches( | 1039 void TestingAutomationProvider::AutocompleteEditGetMatches( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 if (!tab_contents) { | 1114 if (!tab_contents) { |
1115 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); | 1115 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); |
1116 Send(reply_message); | 1116 Send(reply_message); |
1117 return; | 1117 return; |
1118 } | 1118 } |
1119 | 1119 |
1120 // Set the routing id of this message with the controller. | 1120 // Set the routing id of this message with the controller. |
1121 // This routing id needs to be remembered for the reverse | 1121 // This routing id needs to be remembered for the reverse |
1122 // communication while sending back the response of | 1122 // communication while sending back the response of |
1123 // this javascript execution. | 1123 // this javascript execution. |
1124 std::wstring set_automation_id; | 1124 std::string set_automation_id; |
1125 base::SStringPrintf(&set_automation_id, | 1125 base::SStringPrintf(&set_automation_id, |
1126 L"window.domAutomationController.setAutomationId(%d);", | 1126 "window.domAutomationController.setAutomationId(%d);", |
1127 reply_message->routing_id()); | 1127 reply_message->routing_id()); |
1128 | 1128 |
1129 DCHECK(reply_message_ == NULL); | 1129 DCHECK(reply_message_ == NULL); |
1130 reply_message_ = reply_message; | 1130 reply_message_ = reply_message; |
1131 | 1131 |
1132 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1132 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
1133 frame_xpath, set_automation_id); | 1133 frame_xpath, UTF8ToWide(set_automation_id)); |
1134 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1134 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
1135 frame_xpath, script); | 1135 frame_xpath, script); |
1136 } | 1136 } |
1137 | 1137 |
1138 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, | 1138 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, |
1139 int* count) { | 1139 int* count) { |
1140 *count = -1; // -1 is the error code | 1140 *count = -1; // -1 is the error code |
1141 if (tab_tracker_->ContainsHandle(handle)) { | 1141 if (tab_tracker_->ContainsHandle(handle)) { |
1142 NavigationController* nav_controller = tab_tracker_->GetResource(handle); | 1142 NavigationController* nav_controller = tab_tracker_->GetResource(handle); |
1143 TabContents* tab_contents = nav_controller->tab_contents(); | 1143 TabContents* tab_contents = nav_controller->tab_contents(); |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 // Fill up matches. | 2841 // Fill up matches. |
2842 ListValue* matches = new ListValue; | 2842 ListValue* matches = new ListValue; |
2843 const AutocompleteResult& result = model->result(); | 2843 const AutocompleteResult& result = model->result(); |
2844 for (AutocompleteResult::const_iterator i = result.begin(); | 2844 for (AutocompleteResult::const_iterator i = result.begin(); |
2845 i != result.end(); ++i) { | 2845 i != result.end(); ++i) { |
2846 const AutocompleteMatch& match = *i; | 2846 const AutocompleteMatch& match = *i; |
2847 DictionaryValue* item = new DictionaryValue; // owned by return_value | 2847 DictionaryValue* item = new DictionaryValue; // owned by return_value |
2848 item->SetString("type", AutocompleteMatch::TypeToString(match.type)); | 2848 item->SetString("type", AutocompleteMatch::TypeToString(match.type)); |
2849 item->SetBoolean("starred", match.starred); | 2849 item->SetBoolean("starred", match.starred); |
2850 item->SetString("destination_url", match.destination_url.spec()); | 2850 item->SetString("destination_url", match.destination_url.spec()); |
2851 item->SetString("contents", WideToUTF16Hack(match.contents)); | 2851 item->SetString("contents", match.contents); |
2852 item->SetString("description", WideToUTF16Hack(match.description)); | 2852 item->SetString("description", match.description); |
2853 matches->Append(item); | 2853 matches->Append(item); |
2854 } | 2854 } |
2855 return_value->Set("matches", matches); | 2855 return_value->Set("matches", matches); |
2856 | 2856 |
2857 // Fill up other properties. | 2857 // Fill up other properties. |
2858 DictionaryValue* properties = new DictionaryValue; // owned by return_value | 2858 DictionaryValue* properties = new DictionaryValue; // owned by return_value |
2859 properties->SetBoolean("has_focus", model->has_focus()); | 2859 properties->SetBoolean("has_focus", model->has_focus()); |
2860 properties->SetBoolean("query_in_progress", model->query_in_progress()); | 2860 properties->SetBoolean("query_in_progress", model->query_in_progress()); |
2861 properties->SetString("keyword", WideToUTF16Hack(model->keyword())); | 2861 properties->SetString("keyword", model->keyword()); |
2862 properties->SetString("text", WideToUTF16Hack(edit_view->GetText())); | 2862 properties->SetString("text", edit_view->GetText()); |
2863 return_value->Set("properties", properties); | 2863 return_value->Set("properties", properties); |
2864 | 2864 |
2865 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 2865 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
2866 } | 2866 } |
2867 | 2867 |
2868 // Sample json input: { "command": "SetOmniboxText", | 2868 // Sample json input: { "command": "SetOmniboxText", |
2869 // "text": "goog" } | 2869 // "text": "goog" } |
2870 void TestingAutomationProvider::SetOmniboxText(Browser* browser, | 2870 void TestingAutomationProvider::SetOmniboxText(Browser* browser, |
2871 DictionaryValue* args, | 2871 DictionaryValue* args, |
2872 IPC::Message* reply_message) { | 2872 IPC::Message* reply_message) { |
2873 string16 text; | 2873 string16 text; |
2874 AutomationJSONReply reply(this, reply_message); | 2874 AutomationJSONReply reply(this, reply_message); |
2875 if (!args->GetString("text", &text)) { | 2875 if (!args->GetString("text", &text)) { |
2876 reply.SendError("text missing"); | 2876 reply.SendError("text missing"); |
2877 return; | 2877 return; |
2878 } | 2878 } |
2879 browser->FocusLocationBar(); | 2879 browser->FocusLocationBar(); |
2880 LocationBar* loc_bar = browser->window()->GetLocationBar(); | 2880 LocationBar* loc_bar = browser->window()->GetLocationBar(); |
2881 AutocompleteEditView* edit_view = loc_bar->location_entry(); | 2881 AutocompleteEditView* edit_view = loc_bar->location_entry(); |
2882 edit_view->model()->OnSetFocus(false); | 2882 edit_view->model()->OnSetFocus(false); |
2883 edit_view->SetUserText(UTF16ToWideHack(text)); | 2883 edit_view->SetUserText(text); |
2884 reply.SendSuccess(NULL); | 2884 reply.SendSuccess(NULL); |
2885 } | 2885 } |
2886 | 2886 |
2887 // Sample json input: { "command": "OmniboxMovePopupSelection", | 2887 // Sample json input: { "command": "OmniboxMovePopupSelection", |
2888 // "count": 1 } | 2888 // "count": 1 } |
2889 // Negative count implies up, positive implies down. Count values will be | 2889 // Negative count implies up, positive implies down. Count values will be |
2890 // capped by the size of the popup list. | 2890 // capped by the size of the popup list. |
2891 void TestingAutomationProvider::OmniboxMovePopupSelection( | 2891 void TestingAutomationProvider::OmniboxMovePopupSelection( |
2892 Browser* browser, | 2892 Browser* browser, |
2893 DictionaryValue* args, | 2893 DictionaryValue* args, |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4034 reply.SendError("Disabling sync for given datatypes was unsuccessful"); | 4034 reply.SendError("Disabling sync for given datatypes was unsuccessful"); |
4035 } | 4035 } |
4036 } | 4036 } |
4037 } | 4037 } |
4038 | 4038 |
4039 /* static */ | 4039 /* static */ |
4040 ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles( | 4040 ListValue* TestingAutomationProvider::GetListFromAutoFillProfiles( |
4041 const std::vector<AutoFillProfile*>& autofill_profiles) { | 4041 const std::vector<AutoFillProfile*>& autofill_profiles) { |
4042 ListValue* profiles = new ListValue; | 4042 ListValue* profiles = new ListValue; |
4043 | 4043 |
4044 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string | 4044 std::map<AutoFillFieldType, std::string> autofill_type_to_string |
4045 = GetAutoFillFieldToStringMap(); | 4045 = GetAutoFillFieldToStringMap(); |
4046 | 4046 |
4047 // For each AutoFillProfile, transform it to a dictionary object to return. | 4047 // For each AutoFillProfile, transform it to a dictionary object to return. |
4048 for (std::vector<AutoFillProfile*>::const_iterator it = | 4048 for (std::vector<AutoFillProfile*>::const_iterator it = |
4049 autofill_profiles.begin(); | 4049 autofill_profiles.begin(); |
4050 it != autofill_profiles.end(); ++it) { | 4050 it != autofill_profiles.end(); ++it) { |
4051 AutoFillProfile* profile = *it; | 4051 AutoFillProfile* profile = *it; |
4052 DictionaryValue* profile_info = new DictionaryValue; | 4052 DictionaryValue* profile_info = new DictionaryValue; |
4053 // For each of the types, if it has a value, add it to the dictionary. | 4053 // For each of the types, if it has a value, add it to the dictionary. |
4054 for (std::map<AutoFillFieldType, std::wstring>::iterator | 4054 for (std::map<AutoFillFieldType, std::string>::iterator |
4055 type_it = autofill_type_to_string.begin(); | 4055 type_it = autofill_type_to_string.begin(); |
4056 type_it != autofill_type_to_string.end(); ++type_it) { | 4056 type_it != autofill_type_to_string.end(); ++type_it) { |
4057 string16 value = profile->GetFieldText(AutoFillType(type_it->first)); | 4057 string16 value = profile->GetFieldText(AutoFillType(type_it->first)); |
4058 if (value.length()) { // If there was something stored for that value. | 4058 if (value.length()) { // If there was something stored for that value. |
4059 profile_info->SetString(WideToUTF8(type_it->second), value); | 4059 profile_info->SetString(type_it->second, value); |
4060 } | 4060 } |
4061 } | 4061 } |
4062 profiles->Append(profile_info); | 4062 profiles->Append(profile_info); |
4063 } | 4063 } |
4064 return profiles; | 4064 return profiles; |
4065 } | 4065 } |
4066 | 4066 |
4067 /* static */ | 4067 /* static */ |
4068 ListValue* TestingAutomationProvider::GetListFromCreditCards( | 4068 ListValue* TestingAutomationProvider::GetListFromCreditCards( |
4069 const std::vector<CreditCard*>& credit_cards) { | 4069 const std::vector<CreditCard*>& credit_cards) { |
4070 ListValue* cards = new ListValue; | 4070 ListValue* cards = new ListValue; |
4071 | 4071 |
4072 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string = | 4072 std::map<AutoFillFieldType, std::string> credit_card_type_to_string = |
4073 GetCreditCardFieldToStringMap(); | 4073 GetCreditCardFieldToStringMap(); |
4074 | 4074 |
4075 // For each AutoFillProfile, transform it to a dictionary object to return. | 4075 // For each AutoFillProfile, transform it to a dictionary object to return. |
4076 for (std::vector<CreditCard*>::const_iterator it = | 4076 for (std::vector<CreditCard*>::const_iterator it = |
4077 credit_cards.begin(); | 4077 credit_cards.begin(); |
4078 it != credit_cards.end(); ++it) { | 4078 it != credit_cards.end(); ++it) { |
4079 CreditCard* card = *it; | 4079 CreditCard* card = *it; |
4080 DictionaryValue* card_info = new DictionaryValue; | 4080 DictionaryValue* card_info = new DictionaryValue; |
4081 // For each of the types, if it has a value, add it to the dictionary. | 4081 // For each of the types, if it has a value, add it to the dictionary. |
4082 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4082 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
4083 credit_card_type_to_string.begin(); | 4083 credit_card_type_to_string.begin(); |
4084 type_it != credit_card_type_to_string.end(); ++type_it) { | 4084 type_it != credit_card_type_to_string.end(); ++type_it) { |
4085 string16 value = card->GetFieldText(AutoFillType(type_it->first)); | 4085 string16 value = card->GetFieldText(AutoFillType(type_it->first)); |
4086 // If there was something stored for that value. | 4086 // If there was something stored for that value. |
4087 if (value.length()) { | 4087 if (value.length()) { |
4088 card_info->SetString(WideToUTF8(type_it->second), value); | 4088 card_info->SetString(type_it->second, value); |
4089 } | 4089 } |
4090 } | 4090 } |
4091 cards->Append(card_info); | 4091 cards->Append(card_info); |
4092 } | 4092 } |
4093 return cards; | 4093 return cards; |
4094 } | 4094 } |
4095 | 4095 |
4096 /* static */ | 4096 /* static */ |
4097 std::vector<AutoFillProfile> | 4097 std::vector<AutoFillProfile> |
4098 TestingAutomationProvider::GetAutoFillProfilesFromList( | 4098 TestingAutomationProvider::GetAutoFillProfilesFromList( |
4099 const ListValue& profiles, std::string* error_message) { | 4099 const ListValue& profiles, std::string* error_message) { |
4100 std::vector<AutoFillProfile> autofill_profiles; | 4100 std::vector<AutoFillProfile> autofill_profiles; |
4101 DictionaryValue* profile_info = NULL; | 4101 DictionaryValue* profile_info = NULL; |
4102 string16 current_value; | 4102 string16 current_value; |
4103 | 4103 |
4104 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string = | 4104 std::map<AutoFillFieldType, std::string> autofill_type_to_string = |
4105 GetAutoFillFieldToStringMap(); | 4105 GetAutoFillFieldToStringMap(); |
4106 | 4106 |
4107 int num_profiles = profiles.GetSize(); | 4107 int num_profiles = profiles.GetSize(); |
4108 for (int i = 0; i < num_profiles; i++) { | 4108 for (int i = 0; i < num_profiles; i++) { |
4109 profiles.GetDictionary(i, &profile_info); | 4109 profiles.GetDictionary(i, &profile_info); |
4110 AutoFillProfile profile; | 4110 AutoFillProfile profile; |
4111 // Loop through the possible profile types and add those provided. | 4111 // Loop through the possible profile types and add those provided. |
4112 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4112 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
4113 autofill_type_to_string.begin(); | 4113 autofill_type_to_string.begin(); |
4114 type_it != autofill_type_to_string.end(); ++type_it) { | 4114 type_it != autofill_type_to_string.end(); ++type_it) { |
4115 if (profile_info->HasKey(WideToUTF8(type_it->second))) { | 4115 if (profile_info->HasKey(type_it->second)) { |
4116 if (profile_info->GetString(WideToUTF8(type_it->second), | 4116 if (profile_info->GetString(type_it->second, |
4117 ¤t_value)) { | 4117 ¤t_value)) { |
4118 profile.SetInfo(AutoFillType(type_it->first), current_value); | 4118 profile.SetInfo(AutoFillType(type_it->first), current_value); |
4119 } else { | 4119 } else { |
4120 *error_message= "All values must be strings"; | 4120 *error_message= "All values must be strings"; |
4121 break; | 4121 break; |
4122 } | 4122 } |
4123 } | 4123 } |
4124 } | 4124 } |
4125 autofill_profiles.push_back(profile); | 4125 autofill_profiles.push_back(profile); |
4126 } | 4126 } |
4127 return autofill_profiles; | 4127 return autofill_profiles; |
4128 } | 4128 } |
4129 | 4129 |
4130 /* static */ | 4130 /* static */ |
4131 std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( | 4131 std::vector<CreditCard> TestingAutomationProvider::GetCreditCardsFromList( |
4132 const ListValue& cards, std::string* error_message) { | 4132 const ListValue& cards, std::string* error_message) { |
4133 std::vector<CreditCard> credit_cards; | 4133 std::vector<CreditCard> credit_cards; |
4134 DictionaryValue* card_info = NULL; | 4134 DictionaryValue* card_info = NULL; |
4135 string16 current_value; | 4135 string16 current_value; |
4136 | 4136 |
4137 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string = | 4137 std::map<AutoFillFieldType, std::string> credit_card_type_to_string = |
4138 GetCreditCardFieldToStringMap(); | 4138 GetCreditCardFieldToStringMap(); |
4139 | 4139 |
4140 int num_credit_cards = cards.GetSize(); | 4140 int num_credit_cards = cards.GetSize(); |
4141 for (int i = 0; i < num_credit_cards; i++) { | 4141 for (int i = 0; i < num_credit_cards; i++) { |
4142 cards.GetDictionary(i, &card_info); | 4142 cards.GetDictionary(i, &card_info); |
4143 CreditCard card; | 4143 CreditCard card; |
4144 // Loop through the possible credit card fields and add those provided. | 4144 // Loop through the possible credit card fields and add those provided. |
4145 for (std::map<AutoFillFieldType, std::wstring>::iterator type_it = | 4145 for (std::map<AutoFillFieldType, std::string>::iterator type_it = |
4146 credit_card_type_to_string.begin(); | 4146 credit_card_type_to_string.begin(); |
4147 type_it != credit_card_type_to_string.end(); ++type_it) { | 4147 type_it != credit_card_type_to_string.end(); ++type_it) { |
4148 if (card_info->HasKey(WideToUTF8(type_it->second))) { | 4148 if (card_info->HasKey(type_it->second)) { |
4149 if (card_info->GetString(WideToUTF8(type_it->second), ¤t_value)) { | 4149 if (card_info->GetString(type_it->second, ¤t_value)) { |
4150 card.SetInfo(AutoFillType(type_it->first), current_value); | 4150 card.SetInfo(AutoFillType(type_it->first), current_value); |
4151 } else { | 4151 } else { |
4152 *error_message= "All values must be strings"; | 4152 *error_message= "All values must be strings"; |
4153 break; | 4153 break; |
4154 } | 4154 } |
4155 } | 4155 } |
4156 } | 4156 } |
4157 credit_cards.push_back(card); | 4157 credit_cards.push_back(card); |
4158 } | 4158 } |
4159 return credit_cards; | 4159 return credit_cards; |
4160 } | 4160 } |
4161 | 4161 |
4162 /* static */ | 4162 /* static */ |
4163 std::map<AutoFillFieldType, std::wstring> | 4163 std::map<AutoFillFieldType, std::string> |
4164 TestingAutomationProvider::GetAutoFillFieldToStringMap() { | 4164 TestingAutomationProvider::GetAutoFillFieldToStringMap() { |
4165 std::map<AutoFillFieldType, std::wstring> autofill_type_to_string; | 4165 std::map<AutoFillFieldType, std::string> autofill_type_to_string; |
4166 autofill_type_to_string[NAME_FIRST] = L"NAME_FIRST"; | 4166 autofill_type_to_string[NAME_FIRST] = "NAME_FIRST"; |
4167 autofill_type_to_string[NAME_MIDDLE] = L"NAME_MIDDLE"; | 4167 autofill_type_to_string[NAME_MIDDLE] = "NAME_MIDDLE"; |
4168 autofill_type_to_string[NAME_LAST] = L"NAME_LAST"; | 4168 autofill_type_to_string[NAME_LAST] = "NAME_LAST"; |
4169 autofill_type_to_string[COMPANY_NAME] = L"COMPANY_NAME"; | 4169 autofill_type_to_string[COMPANY_NAME] = "COMPANY_NAME"; |
4170 autofill_type_to_string[EMAIL_ADDRESS] = L"EMAIL_ADDRESS"; | 4170 autofill_type_to_string[EMAIL_ADDRESS] = "EMAIL_ADDRESS"; |
4171 autofill_type_to_string[ADDRESS_HOME_LINE1] = L"ADDRESS_HOME_LINE1"; | 4171 autofill_type_to_string[ADDRESS_HOME_LINE1] = "ADDRESS_HOME_LINE1"; |
4172 autofill_type_to_string[ADDRESS_HOME_LINE2] = L"ADDRESS_HOME_LINE2"; | 4172 autofill_type_to_string[ADDRESS_HOME_LINE2] = "ADDRESS_HOME_LINE2"; |
4173 autofill_type_to_string[ADDRESS_HOME_CITY] = L"ADDRESS_HOME_CITY"; | 4173 autofill_type_to_string[ADDRESS_HOME_CITY] = "ADDRESS_HOME_CITY"; |
4174 autofill_type_to_string[ADDRESS_HOME_STATE] = L"ADDRESS_HOME_STATE"; | 4174 autofill_type_to_string[ADDRESS_HOME_STATE] = "ADDRESS_HOME_STATE"; |
4175 autofill_type_to_string[ADDRESS_HOME_ZIP] = L"ADDRESS_HOME_ZIP"; | 4175 autofill_type_to_string[ADDRESS_HOME_ZIP] = "ADDRESS_HOME_ZIP"; |
4176 autofill_type_to_string[ADDRESS_HOME_COUNTRY] = L"ADDRESS_HOME_COUNTRY"; | 4176 autofill_type_to_string[ADDRESS_HOME_COUNTRY] = "ADDRESS_HOME_COUNTRY"; |
4177 autofill_type_to_string[PHONE_HOME_WHOLE_NUMBER] = | 4177 autofill_type_to_string[PHONE_HOME_WHOLE_NUMBER] = |
4178 L"PHONE_HOME_WHOLE_NUMBER"; | 4178 "PHONE_HOME_WHOLE_NUMBER"; |
4179 autofill_type_to_string[PHONE_FAX_WHOLE_NUMBER] = L"PHONE_FAX_WHOLE_NUMBER"; | 4179 autofill_type_to_string[PHONE_FAX_WHOLE_NUMBER] = "PHONE_FAX_WHOLE_NUMBER"; |
4180 autofill_type_to_string[NAME_FIRST] = L"NAME_FIRST"; | 4180 autofill_type_to_string[NAME_FIRST] = "NAME_FIRST"; |
4181 return autofill_type_to_string; | 4181 return autofill_type_to_string; |
4182 } | 4182 } |
4183 | 4183 |
4184 /* static */ | 4184 /* static */ |
4185 std::map<AutoFillFieldType, std::wstring> | 4185 std::map<AutoFillFieldType, std::string> |
4186 TestingAutomationProvider::GetCreditCardFieldToStringMap() { | 4186 TestingAutomationProvider::GetCreditCardFieldToStringMap() { |
4187 std::map<AutoFillFieldType, std::wstring> credit_card_type_to_string; | 4187 std::map<AutoFillFieldType, std::string> credit_card_type_to_string; |
4188 credit_card_type_to_string[CREDIT_CARD_NAME] = L"CREDIT_CARD_NAME"; | 4188 credit_card_type_to_string[CREDIT_CARD_NAME] = "CREDIT_CARD_NAME"; |
4189 credit_card_type_to_string[CREDIT_CARD_NUMBER] = L"CREDIT_CARD_NUMBER"; | 4189 credit_card_type_to_string[CREDIT_CARD_NUMBER] = "CREDIT_CARD_NUMBER"; |
4190 credit_card_type_to_string[CREDIT_CARD_EXP_MONTH] = L"CREDIT_CARD_EXP_MONTH"; | 4190 credit_card_type_to_string[CREDIT_CARD_EXP_MONTH] = "CREDIT_CARD_EXP_MONTH"; |
4191 credit_card_type_to_string[CREDIT_CARD_EXP_4_DIGIT_YEAR] = | 4191 credit_card_type_to_string[CREDIT_CARD_EXP_4_DIGIT_YEAR] = |
4192 L"CREDIT_CARD_EXP_4_DIGIT_YEAR"; | 4192 "CREDIT_CARD_EXP_4_DIGIT_YEAR"; |
4193 return credit_card_type_to_string; | 4193 return credit_card_type_to_string; |
4194 } | 4194 } |
4195 | 4195 |
4196 // Refer to GetActiveNotifications() in chrome/test/pyautolib/pyauto.py for | 4196 // Refer to GetActiveNotifications() in chrome/test/pyautolib/pyauto.py for |
4197 // sample json input/output. | 4197 // sample json input/output. |
4198 void TestingAutomationProvider::GetActiveNotifications( | 4198 void TestingAutomationProvider::GetActiveNotifications( |
4199 Browser* browser, | 4199 Browser* browser, |
4200 DictionaryValue* args, | 4200 DictionaryValue* args, |
4201 IPC::Message* reply_message) { | 4201 IPC::Message* reply_message) { |
4202 new GetActiveNotificationsObserver(this, reply_message); | 4202 new GetActiveNotificationsObserver(this, reply_message); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 // If you change this, update Observer for NotificationType::SESSION_END | 4510 // If you change this, update Observer for NotificationType::SESSION_END |
4511 // below. | 4511 // below. |
4512 MessageLoop::current()->PostTask(FROM_HERE, | 4512 MessageLoop::current()->PostTask(FROM_HERE, |
4513 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 4513 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
4514 } | 4514 } |
4515 } | 4515 } |
4516 | 4516 |
4517 void TestingAutomationProvider::OnRemoveProvider() { | 4517 void TestingAutomationProvider::OnRemoveProvider() { |
4518 AutomationProviderList::GetInstance()->RemoveProvider(this); | 4518 AutomationProviderList::GetInstance()->RemoveProvider(this); |
4519 } | 4519 } |
OLD | NEW |