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 #include "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "app/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 #include "chrome/browser/automation/automation_provider_json.h" | 22 #include "chrome/browser/automation/automation_provider_json.h" |
23 #include "chrome/browser/automation/automation_provider_list.h" | 23 #include "chrome/browser/automation/automation_provider_list.h" |
24 #include "chrome/browser/automation/automation_provider_observers.h" | 24 #include "chrome/browser/automation/automation_provider_observers.h" |
25 #include "chrome/browser/automation/automation_tab_tracker.h" | 25 #include "chrome/browser/automation/automation_tab_tracker.h" |
26 #include "chrome/browser/automation/automation_window_tracker.h" | 26 #include "chrome/browser/automation/automation_window_tracker.h" |
27 #include "chrome/browser/automation/ui_controls.h" | 27 #include "chrome/browser/automation/ui_controls.h" |
28 #include "chrome/browser/bookmarks/bookmark_model.h" | 28 #include "chrome/browser/bookmarks/bookmark_model.h" |
29 #include "chrome/browser/bookmarks/bookmark_storage.h" | 29 #include "chrome/browser/bookmarks/bookmark_storage.h" |
30 #include "chrome/browser/blocked_popup_container.h" | 30 #include "chrome/browser/blocked_popup_container.h" |
31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
32 #include "chrome/browser/browser_shutdown.h" | |
32 #include "chrome/browser/browser_window.h" | 33 #include "chrome/browser/browser_window.h" |
33 #include "chrome/browser/debugger/devtools_manager.h" | 34 #include "chrome/browser/debugger/devtools_manager.h" |
34 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
35 #include "chrome/browser/download/download_shelf.h" | 36 #include "chrome/browser/download/download_shelf.h" |
36 #include "chrome/browser/extensions/extension_host.h" | 37 #include "chrome/browser/extensions/extension_host.h" |
37 #include "chrome/browser/extensions/extensions_service.h" | 38 #include "chrome/browser/extensions/extensions_service.h" |
38 #include "chrome/browser/find_bar.h" | 39 #include "chrome/browser/find_bar.h" |
39 #include "chrome/browser/location_bar.h" | 40 #include "chrome/browser/location_bar.h" |
40 #include "chrome/browser/login_prompt.h" | 41 #include "chrome/browser/login_prompt.h" |
41 #include "chrome/browser/profile.h" | 42 #include "chrome/browser/profile.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, | 413 IPC_MESSAGE_HANDLER(AutomationMsg_ShutdownSessionService, |
413 ShutdownSessionService) | 414 ShutdownSessionService) |
414 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) | 415 IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting) |
415 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) | 416 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) |
416 | 417 |
417 IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); | 418 IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); |
418 IPC_END_MESSAGE_MAP() | 419 IPC_END_MESSAGE_MAP() |
419 } | 420 } |
420 | 421 |
421 void TestingAutomationProvider::OnChannelError() { | 422 void TestingAutomationProvider::OnChannelError() { |
422 BrowserList::CloseAllBrowsersAndExit(); | 423 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) |
darin (slow to review)
2010/09/13 18:37:07
LGTM
This might be clearer if we had a helper fun
| |
424 BrowserList::CloseAllBrowsersAndExit(); | |
423 AutomationProvider::OnChannelError(); | 425 AutomationProvider::OnChannelError(); |
424 } | 426 } |
425 | 427 |
426 void TestingAutomationProvider::CloseBrowser(int browser_handle, | 428 void TestingAutomationProvider::CloseBrowser(int browser_handle, |
427 IPC::Message* reply_message) { | 429 IPC::Message* reply_message) { |
428 if (browser_tracker_->ContainsHandle(browser_handle)) { | 430 if (browser_tracker_->ContainsHandle(browser_handle)) { |
429 Browser* browser = browser_tracker_->GetResource(browser_handle); | 431 Browser* browser = browser_tracker_->GetResource(browser_handle); |
430 new BrowserClosedNotificationObserver(browser, this, | 432 new BrowserClosedNotificationObserver(browser, this, |
431 reply_message); | 433 reply_message); |
432 browser->window()->Close(); | 434 browser->window()->Close(); |
(...skipping 3399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3832 DCHECK(type == NotificationType::SESSION_END); | 3834 DCHECK(type == NotificationType::SESSION_END); |
3833 // OnBrowserRemoving does a ReleaseLater. When session end is received we exit | 3835 // OnBrowserRemoving does a ReleaseLater. When session end is received we exit |
3834 // before the task runs resulting in this object not being deleted. This | 3836 // before the task runs resulting in this object not being deleted. This |
3835 // Release balance out the Release scheduled by OnBrowserRemoving. | 3837 // Release balance out the Release scheduled by OnBrowserRemoving. |
3836 Release(); | 3838 Release(); |
3837 } | 3839 } |
3838 | 3840 |
3839 void TestingAutomationProvider::OnRemoveProvider() { | 3841 void TestingAutomationProvider::OnRemoveProvider() { |
3840 AutomationProviderList::GetInstance()->RemoveProvider(this); | 3842 AutomationProviderList::GetInstance()->RemoveProvider(this); |
3841 } | 3843 } |
OLD | NEW |