OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/browser/automation/automation_provider_list.h" | 10 #include "chrome/browser/automation/automation_provider_list.h" |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 IPC_MESSAGE_HANDLER(AutomationMsg_GetSSLInfoBarCountRequest, | 794 IPC_MESSAGE_HANDLER(AutomationMsg_GetSSLInfoBarCountRequest, |
795 GetSSLInfoBarCount) | 795 GetSSLInfoBarCount) |
796 IPC_MESSAGE_HANDLER(AutomationMsg_ClickSSLInfoBarLinkRequest, | 796 IPC_MESSAGE_HANDLER(AutomationMsg_ClickSSLInfoBarLinkRequest, |
797 ClickSSLInfoBarLink) | 797 ClickSSLInfoBarLink) |
798 IPC_MESSAGE_HANDLER(AutomationMsg_GetLastNavigationTimeRequest, | 798 IPC_MESSAGE_HANDLER(AutomationMsg_GetLastNavigationTimeRequest, |
799 GetLastNavigationTime) | 799 GetLastNavigationTime) |
800 IPC_MESSAGE_HANDLER(AutomationMsg_WaitForNavigationRequest, | 800 IPC_MESSAGE_HANDLER(AutomationMsg_WaitForNavigationRequest, |
801 WaitForNavigation) | 801 WaitForNavigation) |
802 IPC_MESSAGE_HANDLER(AutomationMsg_SetIntPreferenceRequest, | 802 IPC_MESSAGE_HANDLER(AutomationMsg_SetIntPreferenceRequest, |
803 SetIntPreference) | 803 SetIntPreference) |
| 804 IPC_MESSAGE_HANDLER(AutomationMsg_ShowingAppModalDialogRequest, |
| 805 GetShowingAppModalDialog) |
804 IPC_END_MESSAGE_MAP() | 806 IPC_END_MESSAGE_MAP() |
805 } | 807 } |
806 | 808 |
807 void AutomationProvider::ActivateTab(const IPC::Message& message, | 809 void AutomationProvider::ActivateTab(const IPC::Message& message, |
808 int handle, int at_index) { | 810 int handle, int at_index) { |
809 int status = -1; | 811 int status = -1; |
810 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 812 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { |
811 Browser* browser = browser_tracker_->GetResource(handle); | 813 Browser* browser = browser_tracker_->GetResource(handle); |
812 if (at_index >= 0 && at_index < browser->tab_count()) { | 814 if (at_index >= 0 && at_index < browser->tab_count()) { |
813 browser->SelectTabContentsAt(at_index, true); | 815 browser->SelectTabContentsAt(at_index, true); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 } | 1058 } |
1057 Send(new AutomationMsg_ActiveTabIndexResponse(message.routing_id(), | 1059 Send(new AutomationMsg_ActiveTabIndexResponse(message.routing_id(), |
1058 active_tab_index)); | 1060 active_tab_index)); |
1059 } | 1061 } |
1060 | 1062 |
1061 void AutomationProvider::GetBrowserWindowCount(const IPC::Message& message) { | 1063 void AutomationProvider::GetBrowserWindowCount(const IPC::Message& message) { |
1062 Send(new AutomationMsg_BrowserWindowCountResponse( | 1064 Send(new AutomationMsg_BrowserWindowCountResponse( |
1063 message.routing_id(), static_cast<int>(BrowserList::size()))); | 1065 message.routing_id(), static_cast<int>(BrowserList::size()))); |
1064 } | 1066 } |
1065 | 1067 |
| 1068 void AutomationProvider::GetShowingAppModalDialog(const IPC::Message& message) { |
| 1069 Send(new AutomationMsg_ShowingAppModalDialogResponse( |
| 1070 message.routing_id(), |
| 1071 static_cast<bool>(BrowserList::IsShowingAppModalDialog()))); |
| 1072 } |
| 1073 |
1066 void AutomationProvider::GetBrowserWindow(const IPC::Message& message, | 1074 void AutomationProvider::GetBrowserWindow(const IPC::Message& message, |
1067 int index) { | 1075 int index) { |
1068 int handle = 0; | 1076 int handle = 0; |
1069 if (index >= 0) { | 1077 if (index >= 0) { |
1070 BrowserList::const_iterator iter = BrowserList::begin(); | 1078 BrowserList::const_iterator iter = BrowserList::begin(); |
1071 | 1079 |
1072 for (; (iter != BrowserList::end()) && (index > 0); ++iter, --index); | 1080 for (; (iter != BrowserList::end()) && (index > 0); ++iter, --index); |
1073 if (iter != BrowserList::end()) { | 1081 if (iter != BrowserList::end()) { |
1074 handle = browser_tracker_->Add(*iter); | 1082 handle = browser_tracker_->Add(*iter); |
1075 } | 1083 } |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 int value) { | 2438 int value) { |
2431 bool success = false; | 2439 bool success = false; |
2432 if (browser_tracker_->ContainsHandle(handle)) { | 2440 if (browser_tracker_->ContainsHandle(handle)) { |
2433 Browser* browser = browser_tracker_->GetResource(handle); | 2441 Browser* browser = browser_tracker_->GetResource(handle); |
2434 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); | 2442 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); |
2435 success = true; | 2443 success = true; |
2436 } | 2444 } |
2437 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), | 2445 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), |
2438 success)); | 2446 success)); |
2439 } | 2447 } |
OLD | NEW |