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/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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); | 702 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); |
703 Send(reply_message); | 703 Send(reply_message); |
704 } | 704 } |
705 | 705 |
706 void AutomationProvider::Reload(int handle, IPC::Message* reply_message) { | 706 void AutomationProvider::Reload(int handle, IPC::Message* reply_message) { |
707 if (tab_tracker_->ContainsHandle(handle)) { | 707 if (tab_tracker_->ContainsHandle(handle)) { |
708 NavigationController* tab = tab_tracker_->GetResource(handle); | 708 NavigationController* tab = tab_tracker_->GetResource(handle); |
709 Browser* browser = FindAndActivateTab(tab); | 709 Browser* browser = FindAndActivateTab(tab); |
710 if (browser && browser->command_updater()->IsCommandEnabled(IDC_RELOAD)) { | 710 if (browser && browser->command_updater()->IsCommandEnabled(IDC_RELOAD)) { |
711 AddNavigationStatusListener(tab, reply_message, 1, false); | 711 AddNavigationStatusListener(tab, reply_message, 1, false); |
712 browser->Reload(); | 712 browser->Reload(CURRENT_TAB); |
713 return; | 713 return; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 AutomationMsg_Reload::WriteReplyParams( | 717 AutomationMsg_Reload::WriteReplyParams( |
718 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); | 718 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); |
719 Send(reply_message); | 719 Send(reply_message); |
720 } | 720 } |
721 | 721 |
722 void AutomationProvider::SetAuth(int tab_handle, | 722 void AutomationProvider::SetAuth(int tab_handle, |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 | 2072 |
2073 AutomationMsg_SendJSONRequest::WriteReplyParams( | 2073 AutomationMsg_SendJSONRequest::WriteReplyParams( |
2074 reply_message, json_return, reply_return); | 2074 reply_message, json_return, reply_return); |
2075 Send(reply_message); | 2075 Send(reply_message); |
2076 } | 2076 } |
2077 | 2077 |
2078 // Sample json input: { "command": "OmniboxAcceptInput" } | 2078 // Sample json input: { "command": "OmniboxAcceptInput" } |
2079 void AutomationProvider::OmniboxAcceptInput(Browser* browser, | 2079 void AutomationProvider::OmniboxAcceptInput(Browser* browser, |
2080 DictionaryValue* args, | 2080 DictionaryValue* args, |
2081 IPC::Message* reply_message) { | 2081 IPC::Message* reply_message) { |
2082 NavigationController& tab = | 2082 NavigationController& controller = |
2083 browser->GetOrCloneNavigationControllerForDisposition(CURRENT_TAB); | 2083 browser->GetSelectedTabContents()->controller(); |
2084 // Setup observer to wait until the selected item loads. | 2084 // Setup observer to wait until the selected item loads. |
2085 NotificationObserver* observer = | 2085 NotificationObserver* observer = |
2086 new OmniboxAcceptNotificationObserver(&tab, this, reply_message); | 2086 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); |
2087 notification_observer_list_.AddObserver(observer); | 2087 notification_observer_list_.AddObserver(observer); |
2088 | 2088 |
2089 browser->window()->GetLocationBar()->AcceptInput(); | 2089 browser->window()->GetLocationBar()->AcceptInput(); |
2090 } | 2090 } |
2091 | 2091 |
2092 // Sample json input: { "command": "GetPluginsInfo" } | 2092 // Sample json input: { "command": "GetPluginsInfo" } |
2093 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. | 2093 // Refer chrome/test/pyautolib/plugins_info.py for sample json output. |
2094 void AutomationProvider::GetPluginsInfo(Browser* browser, | 2094 void AutomationProvider::GetPluginsInfo(Browser* browser, |
2095 DictionaryValue* args, | 2095 DictionaryValue* args, |
2096 IPC::Message* reply_message) { | 2096 IPC::Message* reply_message) { |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3533 } | 3533 } |
3534 | 3534 |
3535 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 3535 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
3536 NOTIMPLEMENTED(); | 3536 NOTIMPLEMENTED(); |
3537 } | 3537 } |
3538 #endif // !defined(TOOLKIT_VIEWS) | 3538 #endif // !defined(TOOLKIT_VIEWS) |
3539 | 3539 |
3540 void AutomationProvider::ResetToDefaultTheme() { | 3540 void AutomationProvider::ResetToDefaultTheme() { |
3541 profile_->ClearTheme(); | 3541 profile_->ClearTheme(); |
3542 } | 3542 } |
OLD | NEW |