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/message_box_flags.h" | 7 #include "app/message_box_flags.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 *window_count = static_cast<int>(BrowserList::size()); | 1335 *window_count = static_cast<int>(BrowserList::size()); |
1336 } | 1336 } |
1337 | 1337 |
1338 void AutomationProvider::GetNormalBrowserWindowCount(int* window_count) { | 1338 void AutomationProvider::GetNormalBrowserWindowCount(int* window_count) { |
1339 *window_count = static_cast<int>( | 1339 *window_count = static_cast<int>( |
1340 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); | 1340 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); |
1341 } | 1341 } |
1342 | 1342 |
1343 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, | 1343 void AutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, |
1344 int* dialog_button) { | 1344 int* dialog_button) { |
1345 AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog(); | 1345 AppModalDialog* dialog_delegate = |
| 1346 Singleton<AppModalDialogQueue>()->active_dialog(); |
1346 *showing_dialog = (dialog_delegate != NULL); | 1347 *showing_dialog = (dialog_delegate != NULL); |
1347 if (*showing_dialog) | 1348 if (*showing_dialog) |
1348 *dialog_button = dialog_delegate->GetDialogButtons(); | 1349 *dialog_button = dialog_delegate->GetDialogButtons(); |
1349 else | 1350 else |
1350 *dialog_button = MessageBoxFlags::DIALOGBUTTON_NONE; | 1351 *dialog_button = MessageBoxFlags::DIALOGBUTTON_NONE; |
1351 } | 1352 } |
1352 | 1353 |
1353 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { | 1354 void AutomationProvider::ClickAppModalDialogButton(int button, bool* success) { |
1354 *success = false; | 1355 *success = false; |
1355 | 1356 |
1356 AppModalDialog* dialog_delegate = AppModalDialogQueue::active_dialog(); | 1357 AppModalDialog* dialog_delegate = |
| 1358 Singleton<AppModalDialogQueue>()->active_dialog(); |
1357 if (dialog_delegate && | 1359 if (dialog_delegate && |
1358 (dialog_delegate->GetDialogButtons() & button) == button) { | 1360 (dialog_delegate->GetDialogButtons() & button) == button) { |
1359 if ((button & MessageBoxFlags::DIALOGBUTTON_OK) == | 1361 if ((button & MessageBoxFlags::DIALOGBUTTON_OK) == |
1360 MessageBoxFlags::DIALOGBUTTON_OK) { | 1362 MessageBoxFlags::DIALOGBUTTON_OK) { |
1361 dialog_delegate->AcceptWindow(); | 1363 dialog_delegate->AcceptWindow(); |
1362 *success = true; | 1364 *success = true; |
1363 } | 1365 } |
1364 if ((button & MessageBoxFlags::DIALOGBUTTON_CANCEL) == | 1366 if ((button & MessageBoxFlags::DIALOGBUTTON_CANCEL) == |
1365 MessageBoxFlags::DIALOGBUTTON_CANCEL) { | 1367 MessageBoxFlags::DIALOGBUTTON_CANCEL) { |
1366 DCHECK(!*success) << "invalid param, OK and CANCEL specified"; | 1368 DCHECK(!*success) << "invalid param, OK and CANCEL specified"; |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); | 2979 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); |
2978 } | 2980 } |
2979 } | 2981 } |
2980 } | 2982 } |
2981 #endif | 2983 #endif |
2982 | 2984 |
2983 void AutomationProvider::GetWindowTitle(int handle, string16* text) { | 2985 void AutomationProvider::GetWindowTitle(int handle, string16* text) { |
2984 gfx::NativeWindow window = window_tracker_->GetResource(handle); | 2986 gfx::NativeWindow window = window_tracker_->GetResource(handle); |
2985 text->assign(platform_util::GetWindowTitle(window)); | 2987 text->assign(platform_util::GetWindowTitle(window)); |
2986 } | 2988 } |
OLD | NEW |