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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 #endif | 560 #endif |
561 IPC_MESSAGE_HANDLER(AutomationMsg_RemoveBrowsingData, RemoveBrowsingData) | 561 IPC_MESSAGE_HANDLER(AutomationMsg_RemoveBrowsingData, RemoveBrowsingData) |
562 #if defined(TOOLKIT_VIEWS) | 562 #if defined(TOOLKIT_VIEWS) |
563 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange, | 563 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange, |
564 WaitForFocusedViewIDToChange) | 564 WaitForFocusedViewIDToChange) |
565 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus, | 565 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus, |
566 StartTrackingPopupMenus) | 566 StartTrackingPopupMenus) |
567 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForPopupMenuToOpen, | 567 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForPopupMenuToOpen, |
568 WaitForPopupMenuToOpen) | 568 WaitForPopupMenuToOpen) |
569 #endif | 569 #endif |
570 IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) | |
571 IPC_END_MESSAGE_MAP() | 570 IPC_END_MESSAGE_MAP() |
572 } | 571 } |
573 | 572 |
574 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { | 573 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { |
575 *status = -1; | 574 *status = -1; |
576 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 575 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { |
577 Browser* browser = browser_tracker_->GetResource(handle); | 576 Browser* browser = browser_tracker_->GetResource(handle); |
578 if (at_index >= 0 && at_index < browser->tab_count()) { | 577 if (at_index >= 0 && at_index < browser->tab_count()) { |
579 browser->SelectTabContentsAt(at_index, true); | 578 browser->SelectTabContentsAt(at_index, true); |
580 *status = 0; | 579 *status = 0; |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 void AutomationProvider::WaitForExtensionTestResult( | 2786 void AutomationProvider::WaitForExtensionTestResult( |
2788 IPC::Message* reply_message) { | 2787 IPC::Message* reply_message) { |
2789 DCHECK(reply_message_ == NULL); | 2788 DCHECK(reply_message_ == NULL); |
2790 reply_message_ = reply_message; | 2789 reply_message_ = reply_message; |
2791 // Call MaybeSendResult, because the result might have come in before | 2790 // Call MaybeSendResult, because the result might have come in before |
2792 // we were waiting on it. | 2791 // we were waiting on it. |
2793 extension_test_result_observer_->MaybeSendResult(); | 2792 extension_test_result_observer_->MaybeSendResult(); |
2794 } | 2793 } |
2795 | 2794 |
2796 void AutomationProvider::InstallExtensionAndGetHandle( | 2795 void AutomationProvider::InstallExtensionAndGetHandle( |
2797 const FilePath& crx_path, bool with_ui, IPC::Message* reply_message) { | 2796 const FilePath& crx_path, IPC::Message* reply_message) { |
2798 ExtensionsService* service = profile_->GetExtensionsService(); | 2797 ExtensionsService* service = profile_->GetExtensionsService(); |
2799 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); | 2798 ExtensionProcessManager* manager = profile_->GetExtensionProcessManager(); |
2800 if (service && manager) { | 2799 if (service && manager) { |
2801 // The observer will delete itself when done. | 2800 // The observer will delete itself when done. |
2802 new ExtensionReadyNotificationObserver( | 2801 new ExtensionReadyNotificationObserver( |
2803 manager, | 2802 manager, |
2804 this, | 2803 this, |
2805 AutomationMsg_InstallExtensionAndGetHandle::ID, | 2804 AutomationMsg_InstallExtensionAndGetHandle::ID, |
2806 reply_message); | 2805 reply_message); |
2807 | 2806 |
2808 ExtensionInstallUI* client = | |
2809 (with_ui ? new ExtensionInstallUI(profile_) : NULL); | |
2810 scoped_refptr<CrxInstaller> installer( | 2807 scoped_refptr<CrxInstaller> installer( |
2811 new CrxInstaller(service->install_directory(), | 2808 new CrxInstaller(service->install_directory(), |
2812 service, | 2809 service, |
2813 client)); | 2810 NULL)); // silent install, no UI |
2814 installer->set_allow_privilege_increase(true); | 2811 installer->set_allow_privilege_increase(true); |
2815 installer->InstallCrx(crx_path); | 2812 installer->InstallCrx(crx_path); |
2816 } else { | 2813 } else { |
2817 AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams( | 2814 AutomationMsg_InstallExtensionAndGetHandle::WriteReplyParams( |
2818 reply_message, 0); | 2815 reply_message, 0); |
2819 Send(reply_message); | 2816 Send(reply_message); |
2820 } | 2817 } |
2821 } | 2818 } |
2822 | 2819 |
2823 void AutomationProvider::UninstallExtension(int extension_handle, | 2820 void AutomationProvider::UninstallExtension(int extension_handle, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 | 3000 |
3004 void AutomationProvider::StartTrackingPopupMenus( | 3001 void AutomationProvider::StartTrackingPopupMenus( |
3005 int browser_handle, bool* success) { | 3002 int browser_handle, bool* success) { |
3006 NOTIMPLEMENTED(); | 3003 NOTIMPLEMENTED(); |
3007 } | 3004 } |
3008 | 3005 |
3009 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 3006 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
3010 NOTIMPLEMENTED(); | 3007 NOTIMPLEMENTED(); |
3011 } | 3008 } |
3012 #endif // !defined(TOOLKIT_VIEWS) | 3009 #endif // !defined(TOOLKIT_VIEWS) |
3013 | |
3014 void AutomationProvider::ResetToDefaultTheme() { | |
3015 profile_->ClearTheme(); | |
3016 } | |
OLD | NEW |