OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
17 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
18 #include "base/json/string_escape.h" | 18 #include "base/json/string_escape.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/process.h" | 20 #include "base/process.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
22 #include "base/sequenced_task_runner.h" | 22 #include "base/sequenced_task_runner.h" |
23 #include "base/stringprintf.h" | 23 #include "base/stringprintf.h" |
24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
25 #include "base/time.h" | 25 #include "base/time.h" |
26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
27 #include "chrome/app/chrome_command_ids.h" | 27 #include "chrome/app/chrome_command_ids.h" |
28 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 28 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
29 #include "chrome/browser/api/infobars/infobar_service.h" | 29 #include "chrome/browser/api/infobars/infobar_service.h" |
30 #include "chrome/browser/api/infobars/link_infobar_delegate.h" | |
31 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 30 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
32 #include "chrome/browser/autocomplete/autocomplete_match.h" | 31 #include "chrome/browser/autocomplete/autocomplete_match.h" |
33 #include "chrome/browser/autocomplete/autocomplete_result.h" | 32 #include "chrome/browser/autocomplete/autocomplete_result.h" |
34 #include "chrome/browser/automation/automation_browser_tracker.h" | 33 #include "chrome/browser/automation/automation_browser_tracker.h" |
35 #include "chrome/browser/automation/automation_provider_json.h" | 34 #include "chrome/browser/automation/automation_provider_json.h" |
36 #include "chrome/browser/automation/automation_provider_list.h" | 35 #include "chrome/browser/automation/automation_provider_list.h" |
37 #include "chrome/browser/automation/automation_provider_observers.h" | 36 #include "chrome/browser/automation/automation_provider_observers.h" |
38 #include "chrome/browser/automation/automation_tab_tracker.h" | 37 #include "chrome/browser/automation/automation_tab_tracker.h" |
39 #include "chrome/browser/automation/automation_util.h" | 38 #include "chrome/browser/automation/automation_util.h" |
40 #include "chrome/browser/automation/automation_window_tracker.h" | 39 #include "chrome/browser/automation/automation_window_tracker.h" |
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 ConfirmInfoBarDelegate::BUTTON_OK)); | 2155 ConfirmInfoBarDelegate::BUTTON_OK)); |
2157 buttons_list->Append(button_label); | 2156 buttons_list->Append(button_label); |
2158 } | 2157 } |
2159 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { | 2158 if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { |
2160 StringValue* button_label = new StringValue( | 2159 StringValue* button_label = new StringValue( |
2161 confirm_infobar->GetButtonLabel( | 2160 confirm_infobar->GetButtonLabel( |
2162 ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 2161 ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
2163 buttons_list->Append(button_label); | 2162 buttons_list->Append(button_label); |
2164 } | 2163 } |
2165 infobar_item->Set("buttons", buttons_list); | 2164 infobar_item->Set("buttons", buttons_list); |
2166 } else if (infobar->AsLinkInfoBarDelegate()) { | |
2167 infobar_item->SetString("type", "link_infobar"); | |
2168 LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate(); | |
2169 infobar_item->SetString("link_text", link_infobar->GetLinkText()); | |
2170 } else if (infobar->AsExtensionInfoBarDelegate()) { | 2165 } else if (infobar->AsExtensionInfoBarDelegate()) { |
2171 infobar_item->SetString("type", "extension_infobar"); | 2166 infobar_item->SetString("type", "extension_infobar"); |
2172 } else { | 2167 } else { |
2173 infobar_item->SetString("type", "unknown_infobar"); | 2168 infobar_item->SetString("type", "unknown_infobar"); |
2174 } | 2169 } |
2175 infobars->Append(infobar_item); | 2170 infobars->Append(infobar_item); |
2176 } | 2171 } |
2177 return infobars; | 2172 return infobars; |
2178 } | 2173 } |
2179 | 2174 |
(...skipping 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6270 if (g_browser_process) | 6265 if (g_browser_process) |
6271 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6266 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6272 } | 6267 } |
6273 | 6268 |
6274 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6269 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6275 WebContents* tab) { | 6270 WebContents* tab) { |
6276 TabStripModel* tab_strip = browser->tab_strip_model(); | 6271 TabStripModel* tab_strip = browser->tab_strip_model(); |
6277 if (tab_strip->GetActiveWebContents() != tab) | 6272 if (tab_strip->GetActiveWebContents() != tab) |
6278 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6273 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
6279 } | 6274 } |
OLD | NEW |