OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "chrome/browser/sessions/session_tab_helper.h" | 86 #include "chrome/browser/sessions/session_tab_helper.h" |
87 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 87 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
88 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 88 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
89 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" | 89 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" |
90 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 90 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
91 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 91 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
92 #include "chrome/browser/ui/browser_commands.h" | 92 #include "chrome/browser/ui/browser_commands.h" |
93 #include "chrome/browser/ui/browser_finder.h" | 93 #include "chrome/browser/ui/browser_finder.h" |
94 #include "chrome/browser/ui/browser_instant_controller.h" | 94 #include "chrome/browser/ui/browser_instant_controller.h" |
95 #include "chrome/browser/ui/browser_iterator.h" | 95 #include "chrome/browser/ui/browser_iterator.h" |
| 96 #include "chrome/browser/ui/browser_list.h" |
96 #include "chrome/browser/ui/browser_list_impl.h" | 97 #include "chrome/browser/ui/browser_list_impl.h" |
97 #include "chrome/browser/ui/browser_tabstrip.h" | 98 #include "chrome/browser/ui/browser_tabstrip.h" |
98 #include "chrome/browser/ui/browser_window.h" | 99 #include "chrome/browser/ui/browser_window.h" |
99 #include "chrome/browser/ui/extensions/application_launch.h" | 100 #include "chrome/browser/ui/extensions/application_launch.h" |
100 #include "chrome/browser/ui/find_bar/find_bar.h" | 101 #include "chrome/browser/ui/find_bar/find_bar.h" |
101 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 102 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
102 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 103 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
103 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 104 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
104 #include "chrome/browser/ui/host_desktop.h" | 105 #include "chrome/browser/ui/host_desktop.h" |
105 #include "chrome/browser/ui/login/login_prompt.h" | 106 #include "chrome/browser/ui/login/login_prompt.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 IDC_SELECT_PREVIOUS_TAB, | 248 IDC_SELECT_PREVIOUS_TAB, |
248 IDC_SHOW_BOOKMARK_MANAGER, | 249 IDC_SHOW_BOOKMARK_MANAGER, |
249 }; | 250 }; |
250 | 251 |
251 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) | 252 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) |
252 : AutomationProvider(profile) | 253 : AutomationProvider(profile) |
253 #if defined(OS_CHROMEOS) | 254 #if defined(OS_CHROMEOS) |
254 , power_manager_observer_(NULL) | 255 , power_manager_observer_(NULL) |
255 #endif | 256 #endif |
256 { | 257 { |
257 // The automation layer doesn't support non-native desktops. | 258 BrowserList::AddObserver(this); |
258 chrome::BrowserListImpl::GetInstance( | |
259 chrome::HOST_DESKTOP_TYPE_NATIVE)->AddObserver(this); | |
260 registrar_.Add(this, chrome::NOTIFICATION_SESSION_END, | 259 registrar_.Add(this, chrome::NOTIFICATION_SESSION_END, |
261 content::NotificationService::AllSources()); | 260 content::NotificationService::AllSources()); |
262 #if defined(OS_CHROMEOS) | 261 #if defined(OS_CHROMEOS) |
263 AddChromeosObservers(); | 262 AddChromeosObservers(); |
264 #endif | 263 #endif |
265 } | 264 } |
266 | 265 |
267 TestingAutomationProvider::~TestingAutomationProvider() { | 266 TestingAutomationProvider::~TestingAutomationProvider() { |
268 #if defined(OS_CHROMEOS) | 267 #if defined(OS_CHROMEOS) |
269 RemoveChromeosObservers(); | 268 RemoveChromeosObservers(); |
270 #endif | 269 #endif |
271 // The automation layer doesn't support non-native desktops. | 270 BrowserList::RemoveObserver(this); |
272 chrome::BrowserListImpl::GetInstance( | |
273 chrome::HOST_DESKTOP_TYPE_NATIVE)->RemoveObserver(this); | |
274 } | 271 } |
275 | 272 |
276 IPC::Channel::Mode TestingAutomationProvider::GetChannelMode( | 273 IPC::Channel::Mode TestingAutomationProvider::GetChannelMode( |
277 bool use_named_interface) { | 274 bool use_named_interface) { |
278 if (use_named_interface) | 275 if (use_named_interface) |
279 #if defined(OS_POSIX) | 276 #if defined(OS_POSIX) |
280 return IPC::Channel::MODE_OPEN_NAMED_SERVER; | 277 return IPC::Channel::MODE_OPEN_NAMED_SERVER; |
281 #else | 278 #else |
282 return IPC::Channel::MODE_NAMED_SERVER; | 279 return IPC::Channel::MODE_NAMED_SERVER; |
283 #endif | 280 #endif |
(...skipping 5682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5966 if (g_browser_process) | 5963 if (g_browser_process) |
5967 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5964 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5968 } | 5965 } |
5969 | 5966 |
5970 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5967 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5971 WebContents* tab) { | 5968 WebContents* tab) { |
5972 TabStripModel* tab_strip = browser->tab_strip_model(); | 5969 TabStripModel* tab_strip = browser->tab_strip_model(); |
5973 if (tab_strip->GetActiveWebContents() != tab) | 5970 if (tab_strip->GetActiveWebContents() != tab) |
5974 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5971 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5975 } | 5972 } |
OLD | NEW |