| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "app/l10n_util.h" |
| 7 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
| 8 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 13 #include "base/thread.h" | 14 #include "base/thread.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/app/chrome_dll_resource.h" | 16 #include "chrome/app/chrome_dll_resource.h" |
| 16 #include "chrome/browser/app_modal_dialog.h" | 17 #include "chrome/browser/app_modal_dialog.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Reload, Reload) | 949 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Reload, Reload) |
| 949 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_SetAuth, SetAuth) | 950 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_SetAuth, SetAuth) |
| 950 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CancelAuth, CancelAuth) | 951 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CancelAuth, CancelAuth) |
| 951 IPC_MESSAGE_HANDLER(AutomationMsg_NeedsAuth, NeedsAuth) | 952 IPC_MESSAGE_HANDLER(AutomationMsg_NeedsAuth, NeedsAuth) |
| 952 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_RedirectsFrom, | 953 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_RedirectsFrom, |
| 953 GetRedirectsFrom) | 954 GetRedirectsFrom) |
| 954 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindowCount, GetBrowserWindowCount) | 955 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindowCount, GetBrowserWindowCount) |
| 955 IPC_MESSAGE_HANDLER(AutomationMsg_NormalBrowserWindowCount, | 956 IPC_MESSAGE_HANDLER(AutomationMsg_NormalBrowserWindowCount, |
| 956 GetNormalBrowserWindowCount) | 957 GetNormalBrowserWindowCount) |
| 957 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindow, GetBrowserWindow) | 958 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindow, GetBrowserWindow) |
| 959 IPC_MESSAGE_HANDLER(AutomationMsg_GetBrowserLocale, GetBrowserLocale) |
| 958 IPC_MESSAGE_HANDLER(AutomationMsg_LastActiveBrowserWindow, | 960 IPC_MESSAGE_HANDLER(AutomationMsg_LastActiveBrowserWindow, |
| 959 GetLastActiveBrowserWindow) | 961 GetLastActiveBrowserWindow) |
| 960 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveWindow, GetActiveWindow) | 962 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveWindow, GetActiveWindow) |
| 961 IPC_MESSAGE_HANDLER(AutomationMsg_FindNormalBrowserWindow, | 963 IPC_MESSAGE_HANDLER(AutomationMsg_FindNormalBrowserWindow, |
| 962 FindNormalBrowserWindow) | 964 FindNormalBrowserWindow) |
| 963 IPC_MESSAGE_HANDLER(AutomationMsg_IsWindowActive, IsWindowActive) | 965 IPC_MESSAGE_HANDLER(AutomationMsg_IsWindowActive, IsWindowActive) |
| 964 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateWindow, ActivateWindow) | 966 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateWindow, ActivateWindow) |
| 965 #if defined(OS_WIN) | 967 #if defined(OS_WIN) |
| 966 IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) | 968 IPC_MESSAGE_HANDLER(AutomationMsg_WindowHWND, GetWindowHWND) |
| 967 #endif // defined(OS_WIN) | 969 #endif // defined(OS_WIN) |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 } | 1330 } |
| 1329 | 1331 |
| 1330 void AutomationProvider::GetActiveTabIndex(int handle, int* active_tab_index) { | 1332 void AutomationProvider::GetActiveTabIndex(int handle, int* active_tab_index) { |
| 1331 *active_tab_index = -1; // -1 is the error code | 1333 *active_tab_index = -1; // -1 is the error code |
| 1332 if (browser_tracker_->ContainsHandle(handle)) { | 1334 if (browser_tracker_->ContainsHandle(handle)) { |
| 1333 Browser* browser = browser_tracker_->GetResource(handle); | 1335 Browser* browser = browser_tracker_->GetResource(handle); |
| 1334 *active_tab_index = browser->selected_index(); | 1336 *active_tab_index = browser->selected_index(); |
| 1335 } | 1337 } |
| 1336 } | 1338 } |
| 1337 | 1339 |
| 1340 void AutomationProvider::GetBrowserLocale(string16* locale) { |
| 1341 DCHECK(g_browser_process); |
| 1342 *locale = WideToUTF16(g_browser_process->GetApplicationLocale()); |
| 1343 } |
| 1344 |
| 1338 void AutomationProvider::GetBrowserWindowCount(int* window_count) { | 1345 void AutomationProvider::GetBrowserWindowCount(int* window_count) { |
| 1339 *window_count = static_cast<int>(BrowserList::size()); | 1346 *window_count = static_cast<int>(BrowserList::size()); |
| 1340 } | 1347 } |
| 1341 | 1348 |
| 1342 void AutomationProvider::GetNormalBrowserWindowCount(int* window_count) { | 1349 void AutomationProvider::GetNormalBrowserWindowCount(int* window_count) { |
| 1343 *window_count = static_cast<int>( | 1350 *window_count = static_cast<int>( |
| 1344 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); | 1351 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); |
| 1345 } | 1352 } |
| 1346 | 1353 |
| 1347 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, | 1354 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, |
| (...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 if (container) { | 3025 if (container) { |
| 3019 *count = static_cast<int>(container->GetBlockedPopupCount()); | 3026 *count = static_cast<int>(container->GetBlockedPopupCount()); |
| 3020 } else { | 3027 } else { |
| 3021 // If we don't have a container, we don't have any blocked popups to | 3028 // If we don't have a container, we don't have any blocked popups to |
| 3022 // contain! | 3029 // contain! |
| 3023 *count = 0; | 3030 *count = 0; |
| 3024 } | 3031 } |
| 3025 } | 3032 } |
| 3026 } | 3033 } |
| 3027 } | 3034 } |
| OLD | NEW |