Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome_frame/chrome_frame_automation.cc

Issue 6756044: Remove extension automation support that was used only by CEEE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame_automation.h ('k') | chrome_frame/chrome_frame_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_frame/chrome_frame_automation.h" 5 #include "chrome_frame/chrome_frame_automation.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 SyncMessageCallContext* context) { 113 SyncMessageCallContext* context) {
114 switch (context->message_type()) { 114 switch (context->message_type()) {
115 case AutomationMsg_CreateExternalTab::ID: 115 case AutomationMsg_CreateExternalTab::ID:
116 case AutomationMsg_ConnectExternalTab::ID: 116 case AutomationMsg_ConnectExternalTab::ID:
117 InvokeCallback<CreateExternalTabContext>(msg, context); 117 InvokeCallback<CreateExternalTabContext>(msg, context);
118 break; 118 break;
119 case AutomationMsg_NavigateExternalTabAtIndex::ID: 119 case AutomationMsg_NavigateExternalTabAtIndex::ID:
120 case AutomationMsg_NavigateInExternalTab::ID: 120 case AutomationMsg_NavigateInExternalTab::ID:
121 InvokeCallback<BeginNavigateContext>(msg, context); 121 InvokeCallback<BeginNavigateContext>(msg, context);
122 break; 122 break;
123 case AutomationMsg_InstallExtension::ID:
124 InvokeCallback<InstallExtensionContext>(msg, context);
125 break;
126 case AutomationMsg_LoadExpandedExtension::ID:
127 InvokeCallback<InstallExtensionContext>(msg, context);
128 break;
129 case AutomationMsg_GetEnabledExtensions::ID:
130 InvokeCallback<GetEnabledExtensionsContext>(msg, context);
131 break;
132 case AutomationMsg_RunUnloadHandlers::ID: 123 case AutomationMsg_RunUnloadHandlers::ID:
133 InvokeCallback<UnloadContext>(msg, context); 124 InvokeCallback<UnloadContext>(msg, context);
134 break; 125 break;
135 default: 126 default:
136 NOTREACHED(); 127 NOTREACHED();
137 } 128 }
138 return true; 129 return true;
139 } 130 }
140 }; 131 };
141 132
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 params.search_string = WideToUTF16Hack(search_string); 833 params.search_string = WideToUTF16Hack(search_string);
843 params.find_next = find_next; 834 params.find_next = find_next;
844 params.match_case = (match_case == CASE_SENSITIVE); 835 params.match_case = (match_case == CASE_SENSITIVE);
845 params.forward = (forward == FWD); 836 params.forward = (forward == FWD);
846 837
847 IPC::SyncMessage* msg = 838 IPC::SyncMessage* msg =
848 new AutomationMsg_Find(tab_->handle(), params, NULL, NULL); 839 new AutomationMsg_Find(tab_->handle(), params, NULL, NULL);
849 automation_server_->SendAsAsync(msg, NULL, this); 840 automation_server_->SendAsAsync(msg, NULL, this);
850 } 841 }
851 842
852 void ChromeFrameAutomationClient::InstallExtension(
853 const FilePath& crx_path,
854 void* user_data) {
855 if (automation_server_ == NULL) {
856 InstallExtensionComplete(crx_path,
857 user_data,
858 AUTOMATION_MSG_EXTENSION_INSTALL_FAILED);
859 return;
860 }
861
862 InstallExtensionContext* ctx = new InstallExtensionContext(
863 this, crx_path, user_data);
864
865 IPC::SyncMessage* msg = new AutomationMsg_InstallExtension(crx_path, NULL);
866
867 // The context will delete itself after it is called.
868 automation_server_->SendAsAsync(msg, ctx, this);
869 }
870
871 void ChromeFrameAutomationClient::InstallExtensionComplete(
872 const FilePath& crx_path,
873 void* user_data,
874 AutomationMsg_ExtensionResponseValues res) {
875 DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
876
877 if (chrome_frame_delegate_) {
878 chrome_frame_delegate_->OnExtensionInstalled(crx_path, user_data, res);
879 }
880 }
881
882 void ChromeFrameAutomationClient::GetEnabledExtensions(void* user_data) {
883 if (automation_server_ == NULL) {
884 GetEnabledExtensionsComplete(user_data, &std::vector<FilePath>());
885 return;
886 }
887
888 GetEnabledExtensionsContext* ctx = new GetEnabledExtensionsContext(
889 this, user_data);
890
891 IPC::SyncMessage* msg = new AutomationMsg_GetEnabledExtensions(
892 ctx->extension_directories());
893
894 // The context will delete itself after it is called.
895 automation_server_->SendAsAsync(msg, ctx, this);
896 }
897
898 void ChromeFrameAutomationClient::GetEnabledExtensionsComplete(
899 void* user_data,
900 std::vector<FilePath>* extension_directories) {
901 DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
902
903 if (chrome_frame_delegate_) {
904 chrome_frame_delegate_->OnGetEnabledExtensionsComplete(
905 user_data, *extension_directories);
906 }
907
908 delete extension_directories;
909 }
910
911 int ChromeFrameAutomationClient::GetSessionId() const {
912 return session_id_;
913 }
914
915 void ChromeFrameAutomationClient::OnChromeFrameHostMoved() { 843 void ChromeFrameAutomationClient::OnChromeFrameHostMoved() {
916 // Use a local var to avoid the small possibility of getting the tab_ 844 // Use a local var to avoid the small possibility of getting the tab_
917 // member be cleared while we try to use it. 845 // member be cleared while we try to use it.
918 // Note that TabProxy is a RefCountedThreadSafe object, so we should be OK. 846 // Note that TabProxy is a RefCountedThreadSafe object, so we should be OK.
919 scoped_refptr<TabProxy> tab(tab_); 847 scoped_refptr<TabProxy> tab(tab_);
920 // There also is a possibility that tab_ has not been set yet, 848 // There also is a possibility that tab_ has not been set yet,
921 // so we still need to test for NULL. 849 // so we still need to test for NULL.
922 if (tab) 850 if (tab)
923 tab->OnHostMoved(); 851 tab->OnHostMoved();
924 } 852 }
925 853
926 void ChromeFrameAutomationClient::LoadExpandedExtension(
927 const FilePath& path,
928 void* user_data) {
929 if (automation_server_ == NULL) {
930 InstallExtensionComplete(path,
931 user_data,
932 AUTOMATION_MSG_EXTENSION_INSTALL_FAILED);
933 return;
934 }
935
936 InstallExtensionContext* ctx = new InstallExtensionContext(
937 this, path, user_data);
938
939 IPC::SyncMessage* msg = new AutomationMsg_LoadExpandedExtension(path, NULL);
940
941 // The context will delete itself after it is called.
942 automation_server_->SendAsAsync(msg, ctx, this);
943 }
944
945 void ChromeFrameAutomationClient::CreateExternalTab() { 854 void ChromeFrameAutomationClient::CreateExternalTab() {
946 AutomationLaunchResult launch_result = AUTOMATION_SUCCESS; 855 AutomationLaunchResult launch_result = AUTOMATION_SUCCESS;
947 DCHECK(IsWindow()); 856 DCHECK(IsWindow());
948 DCHECK(automation_server_ != NULL); 857 DCHECK(automation_server_ != NULL);
949 858
950 if (chrome_launch_params_->url().is_valid()) { 859 if (chrome_launch_params_->url().is_valid()) {
951 navigate_after_initialization_ = false; 860 navigate_after_initialization_ = false;
952 } 861 }
953 862
954 const ExternalTabSettings settings( 863 const ExternalTabSettings settings(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 chrome_window_ = chrome_window; 902 chrome_window_ = chrome_window;
994 tab_window_ = tab_window; 903 tab_window_ = tab_window;
995 tab_ = automation_server_->CreateTabProxy(tab_handle); 904 tab_ = automation_server_->CreateTabProxy(tab_handle);
996 tab_->AddObserver(this); 905 tab_->AddObserver(this);
997 tab_handle_ = tab_handle; 906 tab_handle_ = tab_handle;
998 session_id_ = session_id; 907 session_id_ = session_id;
999 } 908 }
1000 return launch_result; 909 return launch_result;
1001 } 910 }
1002 911
1003 void ChromeFrameAutomationClient::SetEnableExtensionAutomation(
1004 const std::vector<std::string>& functions_enabled) {
1005 if (!is_initialized())
1006 return;
1007
1008 // We are doing initialization, so there is no need to reset extension
1009 // automation, only to set it. Also, we want to avoid resetting extension
1010 // automation that some other automation client has set up. Therefore only
1011 // send the message if we are going to enable automation of some functions.
1012 if (!functions_enabled.empty())
1013 tab_->SetEnableExtensionAutomation(functions_enabled);
1014 }
1015
1016 // Invoked in launch background thread. 912 // Invoked in launch background thread.
1017 void ChromeFrameAutomationClient::LaunchComplete( 913 void ChromeFrameAutomationClient::LaunchComplete(
1018 ChromeFrameAutomationProxy* proxy, 914 ChromeFrameAutomationProxy* proxy,
1019 AutomationLaunchResult result) { 915 AutomationLaunchResult result) {
1020 // If we're shutting down we don't keep a pointer to the automation server. 916 // If we're shutting down we don't keep a pointer to the automation server.
1021 if (init_state_ != UNINITIALIZING) { 917 if (init_state_ != UNINITIALIZING) {
1022 DCHECK(init_state_ == INITIALIZING); 918 DCHECK(init_state_ == INITIALIZING);
1023 automation_server_ = proxy; 919 automation_server_ = proxy;
1024 } else { 920 } else {
1025 DVLOG(1) << "Not storing automation server pointer due to shutting down"; 921 DVLOG(1) << "Not storing automation server pointer due to shutting down";
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 const net::URLRequestStatus& status) { 1358 const net::URLRequestStatus& status) {
1463 automation_server_->Send(new AutomationMsg_RequestEnd( 1359 automation_server_->Send(new AutomationMsg_RequestEnd(
1464 tab_->handle(), request_id, status)); 1360 tab_->handle(), request_id, status));
1465 } 1361 }
1466 1362
1467 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, 1363 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success,
1468 const GURL& url, const std::string& cookie_string, int cookie_id) { 1364 const GURL& url, const std::string& cookie_string, int cookie_id) {
1469 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse( 1365 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(
1470 tab_->handle(), success, url, cookie_string, cookie_id)); 1366 tab_->handle(), success, url, cookie_string, cookie_id));
1471 } 1367 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_automation.h ('k') | chrome_frame/chrome_frame_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698