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

Side by Side Diff: chrome/browser/automation/automation_provider.cc

Issue 20179: Reverting 9388. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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
OLDNEW
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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 IPC_MESSAGE_HANDLER(AutomationMsg_NavigateInExternalTabRequest, 763 IPC_MESSAGE_HANDLER(AutomationMsg_NavigateInExternalTabRequest,
764 NavigateInExternalTab) 764 NavigateInExternalTab)
765 IPC_MESSAGE_HANDLER(AutomationMsg_ShowInterstitialPageRequest, 765 IPC_MESSAGE_HANDLER(AutomationMsg_ShowInterstitialPageRequest,
766 ShowInterstitialPage); 766 ShowInterstitialPage);
767 IPC_MESSAGE_HANDLER(AutomationMsg_HideInterstitialPageRequest, 767 IPC_MESSAGE_HANDLER(AutomationMsg_HideInterstitialPageRequest,
768 HideInterstitialPage); 768 HideInterstitialPage);
769 IPC_MESSAGE_HANDLER(AutomationMsg_SetAcceleratorsForTab, 769 IPC_MESSAGE_HANDLER(AutomationMsg_SetAcceleratorsForTab,
770 SetAcceleratorsForTab) 770 SetAcceleratorsForTab)
771 IPC_MESSAGE_HANDLER(AutomationMsg_ProcessUnhandledAccelerator, 771 IPC_MESSAGE_HANDLER(AutomationMsg_ProcessUnhandledAccelerator,
772 ProcessUnhandledAccelerator) 772 ProcessUnhandledAccelerator)
773 IPC_MESSAGE_HANDLER(AutomationMsg_SetInitialFocus,
774 SetInitialFocus)
775 IPC_MESSAGE_HANDLER(AutomationMsg_WaitForTabToBeRestored, 773 IPC_MESSAGE_HANDLER(AutomationMsg_WaitForTabToBeRestored,
776 WaitForTabToBeRestored) 774 WaitForTabToBeRestored)
777 IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState, 775 IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState,
778 GetSecurityState) 776 GetSecurityState)
779 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType, 777 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType,
780 GetPageType) 778 GetPageType)
781 IPC_MESSAGE_HANDLER(AutomationMsg_ActionOnSSLBlockingPage, 779 IPC_MESSAGE_HANDLER(AutomationMsg_ActionOnSSLBlockingPage,
782 ActionOnSSLBlockingPage) 780 ActionOnSSLBlockingPage)
783 IPC_MESSAGE_HANDLER(AutomationMsg_BringBrowserToFront, BringBrowserToFront) 781 IPC_MESSAGE_HANDLER(AutomationMsg_BringBrowserToFront, BringBrowserToFront)
784 IPC_MESSAGE_HANDLER(AutomationMsg_IsPageMenuCommandEnabled, 782 IPC_MESSAGE_HANDLER(AutomationMsg_IsPageMenuCommandEnabled,
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 2098
2101 Send(new AutomationMsg_NavigateInExternalTabResponse(message.routing_id(), 2099 Send(new AutomationMsg_NavigateInExternalTabResponse(message.routing_id(),
2102 rv)); 2100 rv));
2103 } 2101 }
2104 2102
2105 void AutomationProvider::SetAcceleratorsForTab(const IPC::Message& message, 2103 void AutomationProvider::SetAcceleratorsForTab(const IPC::Message& message,
2106 int handle, 2104 int handle,
2107 HACCEL accel_table, 2105 HACCEL accel_table,
2108 int accel_entry_count) { 2106 int accel_entry_count) {
2109 bool status = false; 2107 bool status = false;
2110 ExternalTabContainer* external_tab = GetExternalTabForHandle(handle); 2108 if (tab_tracker_->ContainsHandle(handle)) {
2111 if (external_tab) { 2109 NavigationController* tab = tab_tracker_->GetResource(handle);
2112 external_tab->SetAccelerators(accel_table, accel_entry_count); 2110 TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB);
2113 status = true; 2111 ExternalTabContainer* external_tab_container =
2112 ExternalTabContainer::GetContainerForTab(
2113 tab_contents->GetContainerHWND());
2114 // This call is only valid on an externally hosted tab
2115 if (external_tab_container) {
2116 external_tab_container->SetAccelerators(accel_table,
2117 accel_entry_count);
2118 status = true;
2119 }
2114 } 2120 }
2115 Send(new AutomationMsg_SetAcceleratorsForTabResponse(message.routing_id(), 2121 Send(new AutomationMsg_SetAcceleratorsForTabResponse(message.routing_id(),
2116 status)); 2122 status));
2117 } 2123 }
2118 2124
2119 void AutomationProvider::ProcessUnhandledAccelerator( 2125 void AutomationProvider::ProcessUnhandledAccelerator(
2120 const IPC::Message& message, int handle, const MSG& msg) { 2126 const IPC::Message& message, int handle, const MSG& msg) {
2121 ExternalTabContainer* external_tab = GetExternalTabForHandle(handle); 2127 if (tab_tracker_->ContainsHandle(handle)) {
2122 if (external_tab) { 2128 NavigationController* tab = tab_tracker_->GetResource(handle);
2123 external_tab->ProcessUnhandledAccelerator(msg); 2129 TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB);
2124 } 2130 ExternalTabContainer* external_tab_container =
2125 // This message expects no response. 2131 ExternalTabContainer::GetContainerForTab(
2126 } 2132 tab_contents->GetContainerHWND());
2127 2133 // This call is only valid on an externally hosted tab
2128 void AutomationProvider::SetInitialFocus(const IPC::Message& message, 2134 if (external_tab_container) {
2129 int handle, bool reverse) { 2135 external_tab_container->ProcessUnhandledAccelerator(msg);
2130 ExternalTabContainer* external_tab = GetExternalTabForHandle(handle); 2136 }
2131 if (external_tab) {
2132 external_tab->SetInitialFocus(reverse);
2133 } 2137 }
2134 // This message expects no response. 2138 // This message expects no response.
2135 } 2139 }
2136 2140
2137 void AutomationProvider::WaitForTabToBeRestored( 2141 void AutomationProvider::WaitForTabToBeRestored(
2138 const IPC::Message& message, 2142 const IPC::Message& message,
2139 int tab_handle) { 2143 int tab_handle) {
2140 if (tab_tracker_->ContainsHandle(tab_handle)) { 2144 if (tab_tracker_->ContainsHandle(tab_handle)) {
2141 NavigationController* tab = tab_tracker_->GetResource(tab_handle); 2145 NavigationController* tab = tab_tracker_->GetResource(tab_handle);
2142 restore_tracker_.reset( 2146 restore_tracker_.reset(
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 TabContents* tab_contents = nav_controller->active_contents(); 2384 TabContents* tab_contents = nav_controller->active_contents();
2381 if (tab_contents && tab_contents->type() == TAB_CONTENTS_WEB) { 2385 if (tab_contents && tab_contents->type() == TAB_CONTENTS_WEB) {
2382 web_contents = tab_contents->AsWebContents(); 2386 web_contents = tab_contents->AsWebContents();
2383 if (tab) 2387 if (tab)
2384 *tab = nav_controller; 2388 *tab = nav_controller;
2385 } 2389 }
2386 } 2390 }
2387 return web_contents; 2391 return web_contents;
2388 } 2392 }
2389 2393
2390 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) {
2391 if (tab_tracker_->ContainsHandle(handle)) {
2392 NavigationController* tab = tab_tracker_->GetResource(handle);
2393 TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB);
2394 DCHECK(tab_contents);
2395 if (tab_contents) {
2396 HWND hwnd = tab_contents->GetContainerHWND();
2397 return ExternalTabContainer::GetContainerForTab(hwnd);
2398 }
2399 }
2400
2401 return NULL;
2402 }
2403
2404 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) 2394 TestingAutomationProvider::TestingAutomationProvider(Profile* profile)
2405 : AutomationProvider(profile) { 2395 : AutomationProvider(profile) {
2406 BrowserList::AddObserver(this); 2396 BrowserList::AddObserver(this);
2407 NotificationService::current()->AddObserver( 2397 NotificationService::current()->AddObserver(
2408 this, 2398 this,
2409 NotificationType::SESSION_END, 2399 NotificationType::SESSION_END,
2410 NotificationService::AllSources()); 2400 NotificationService::AllSources());
2411 } 2401 }
2412 2402
2413 TestingAutomationProvider::~TestingAutomationProvider() { 2403 TestingAutomationProvider::~TestingAutomationProvider() {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 } 2606 }
2617 } 2607 }
2618 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(), 2608 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(),
2619 succeed)); 2609 succeed));
2620 } 2610 }
2621 2611
2622 void AutomationProvider::SavePackageShouldPromptUser( 2612 void AutomationProvider::SavePackageShouldPromptUser(
2623 const IPC::Message& message, bool should_prompt) { 2613 const IPC::Message& message, bool should_prompt) {
2624 SavePackage::SetShouldPromptUser(should_prompt); 2614 SavePackage::SetShouldPromptUser(should_prompt);
2625 } 2615 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.h ('k') | chrome/browser/external_tab_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698