| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1692 BrowserList::AddObserver(this); | 1692 BrowserList::AddObserver(this); |
| 1693 registrar_.Add(this, NotificationType::SESSION_END, | 1693 registrar_.Add(this, NotificationType::SESSION_END, |
| 1694 NotificationService::AllSources()); | 1694 NotificationService::AllSources()); |
| 1695 } | 1695 } |
| 1696 | 1696 |
| 1697 TestingAutomationProvider::~TestingAutomationProvider() { | 1697 TestingAutomationProvider::~TestingAutomationProvider() { |
| 1698 BrowserList::RemoveObserver(this); | 1698 BrowserList::RemoveObserver(this); |
| 1699 } | 1699 } |
| 1700 | 1700 |
| 1701 void TestingAutomationProvider::OnChannelError() { | 1701 void TestingAutomationProvider::OnChannelError() { |
| 1702 BrowserList::CloseAllBrowsers(true); | 1702 BrowserList::CloseAllBrowsersAndExit(); |
| 1703 AutomationProvider::OnChannelError(); | 1703 AutomationProvider::OnChannelError(); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 void TestingAutomationProvider::OnBrowserRemoving(const Browser* browser) { | 1706 void TestingAutomationProvider::OnBrowserRemoving(const Browser* browser) { |
| 1707 // For backwards compatibility with the testing automation interface, we | 1707 // For backwards compatibility with the testing automation interface, we |
| 1708 // want the automation provider (and hence the process) to go away when the | 1708 // want the automation provider (and hence the process) to go away when the |
| 1709 // last browser goes away. | 1709 // last browser goes away. |
| 1710 if (BrowserList::size() == 1) { | 1710 if (BrowserList::size() == 1) { |
| 1711 // If you change this, update Observer for NotificationType::SESSION_END | 1711 // If you change this, update Observer for NotificationType::SESSION_END |
| 1712 // below. | 1712 // below. |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 for (;iter != BrowserList::end(); ++iter) { | 2097 for (;iter != BrowserList::end(); ++iter) { |
| 2098 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); | 2098 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); |
| 2099 if (window == this_window) { | 2099 if (window == this_window) { |
| 2100 // Add() returns the existing handle for the resource if any. | 2100 // Add() returns the existing handle for the resource if any. |
| 2101 *browser_handle = browser_tracker_->Add(*iter); | 2101 *browser_handle = browser_tracker_->Add(*iter); |
| 2102 *success = true; | 2102 *success = true; |
| 2103 return; | 2103 return; |
| 2104 } | 2104 } |
| 2105 } | 2105 } |
| 2106 } | 2106 } |
| OLD | NEW |