| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 5864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5875 base::GetProcId(render_view->GetProcess()->GetHandle()), | 5875 base::GetProcId(render_view->GetProcess()->GetHandle()), |
| 5876 routing_id); | 5876 routing_id); |
| 5877 render_view->Send(new ChromeViewMsg_GetFPS(routing_id)); | 5877 render_view->Send(new ChromeViewMsg_GetFPS(routing_id)); |
| 5878 } | 5878 } |
| 5879 | 5879 |
| 5880 void TestingAutomationProvider::IsFullscreenForBrowser(Browser* browser, | 5880 void TestingAutomationProvider::IsFullscreenForBrowser(Browser* browser, |
| 5881 base::DictionaryValue* args, | 5881 base::DictionaryValue* args, |
| 5882 IPC::Message* reply_message) { | 5882 IPC::Message* reply_message) { |
| 5883 DictionaryValue dict; | 5883 DictionaryValue dict; |
| 5884 dict.SetBoolean("result", | 5884 dict.SetBoolean("result", |
| 5885 browser->fullscreen_controller_->IsFullscreenForBrowser()); | 5885 browser->fullscreen_controller()->IsFullscreenForBrowser()); |
| 5886 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5886 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5887 } | 5887 } |
| 5888 | 5888 |
| 5889 void TestingAutomationProvider::IsFullscreenForTab(Browser* browser, | 5889 void TestingAutomationProvider::IsFullscreenForTab(Browser* browser, |
| 5890 base::DictionaryValue* args, | 5890 base::DictionaryValue* args, |
| 5891 IPC::Message* reply_message) { | 5891 IPC::Message* reply_message) { |
| 5892 DictionaryValue dict; | 5892 DictionaryValue dict; |
| 5893 dict.SetBoolean("result", browser->IsFullscreenForTabOrPending()); | 5893 dict.SetBoolean("result", |
| 5894 browser->fullscreen_controller()->IsFullscreenForTabOrPending()); |
| 5894 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5895 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5895 } | 5896 } |
| 5896 | 5897 |
| 5897 void TestingAutomationProvider::IsMouseLocked(Browser* browser, | 5898 void TestingAutomationProvider::IsMouseLocked(Browser* browser, |
| 5898 base::DictionaryValue* args, | 5899 base::DictionaryValue* args, |
| 5899 IPC::Message* reply_message) { | 5900 IPC::Message* reply_message) { |
| 5900 DictionaryValue dict; | 5901 DictionaryValue dict; |
| 5901 dict.SetBoolean("result", chrome::GetActiveWebContents(browser)-> | 5902 dict.SetBoolean("result", chrome::GetActiveWebContents(browser)-> |
| 5902 GetRenderViewHost()->GetView()->IsMouseLocked()); | 5903 GetRenderViewHost()->GetView()->IsMouseLocked()); |
| 5903 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5904 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5904 } | 5905 } |
| 5905 | 5906 |
| 5906 void TestingAutomationProvider::IsMouseLockPermissionRequested( | 5907 void TestingAutomationProvider::IsMouseLockPermissionRequested( |
| 5907 Browser* browser, | 5908 Browser* browser, |
| 5908 base::DictionaryValue* args, | 5909 base::DictionaryValue* args, |
| 5909 IPC::Message* reply_message) { | 5910 IPC::Message* reply_message) { |
| 5910 FullscreenExitBubbleType type = | 5911 FullscreenExitBubbleType type = |
| 5911 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5912 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5912 bool mouse_lock = false; | 5913 bool mouse_lock = false; |
| 5913 fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock); | 5914 fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock); |
| 5914 DictionaryValue dict; | 5915 DictionaryValue dict; |
| 5915 dict.SetBoolean("result", mouse_lock); | 5916 dict.SetBoolean("result", mouse_lock); |
| 5916 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5917 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5917 } | 5918 } |
| 5918 | 5919 |
| 5919 void TestingAutomationProvider::IsFullscreenPermissionRequested( | 5920 void TestingAutomationProvider::IsFullscreenPermissionRequested( |
| 5920 Browser* browser, | 5921 Browser* browser, |
| 5921 base::DictionaryValue* args, | 5922 base::DictionaryValue* args, |
| 5922 IPC::Message* reply_message) { | 5923 IPC::Message* reply_message) { |
| 5923 FullscreenExitBubbleType type = | 5924 FullscreenExitBubbleType type = |
| 5924 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5925 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5925 bool fullscreen = false; | 5926 bool fullscreen = false; |
| 5926 fullscreen_bubble::PermissionRequestedByType(type, &fullscreen, NULL); | 5927 fullscreen_bubble::PermissionRequestedByType(type, &fullscreen, NULL); |
| 5927 DictionaryValue dict; | 5928 DictionaryValue dict; |
| 5928 dict.SetBoolean("result", fullscreen); | 5929 dict.SetBoolean("result", fullscreen); |
| 5929 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5930 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5930 } | 5931 } |
| 5931 | 5932 |
| 5932 void TestingAutomationProvider::IsFullscreenBubbleDisplayed(Browser* browser, | 5933 void TestingAutomationProvider::IsFullscreenBubbleDisplayed(Browser* browser, |
| 5933 base::DictionaryValue* args, | 5934 base::DictionaryValue* args, |
| 5934 IPC::Message* reply_message) { | 5935 IPC::Message* reply_message) { |
| 5935 FullscreenExitBubbleType type = | 5936 FullscreenExitBubbleType type = |
| 5936 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5937 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5937 DictionaryValue dict; | 5938 DictionaryValue dict; |
| 5938 dict.SetBoolean("result", | 5939 dict.SetBoolean("result", |
| 5939 type != FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); | 5940 type != FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION); |
| 5940 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5941 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5941 } | 5942 } |
| 5942 | 5943 |
| 5943 void TestingAutomationProvider::IsFullscreenBubbleDisplayingButtons( | 5944 void TestingAutomationProvider::IsFullscreenBubbleDisplayingButtons( |
| 5944 Browser* browser, | 5945 Browser* browser, |
| 5945 base::DictionaryValue* args, | 5946 base::DictionaryValue* args, |
| 5946 IPC::Message* reply_message) { | 5947 IPC::Message* reply_message) { |
| 5947 FullscreenExitBubbleType type = | 5948 FullscreenExitBubbleType type = |
| 5948 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5949 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5949 DictionaryValue dict; | 5950 DictionaryValue dict; |
| 5950 dict.SetBoolean("result", fullscreen_bubble::ShowButtonsForType(type)); | 5951 dict.SetBoolean("result", fullscreen_bubble::ShowButtonsForType(type)); |
| 5951 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 5952 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| 5952 } | 5953 } |
| 5953 | 5954 |
| 5954 void TestingAutomationProvider::AcceptCurrentFullscreenOrMouseLockRequest( | 5955 void TestingAutomationProvider::AcceptCurrentFullscreenOrMouseLockRequest( |
| 5955 Browser* browser, | 5956 Browser* browser, |
| 5956 base::DictionaryValue* args, | 5957 base::DictionaryValue* args, |
| 5957 IPC::Message* reply_message) { | 5958 IPC::Message* reply_message) { |
| 5958 WebContents* fullscreen_tab = chrome::GetActiveWebContents(browser); | 5959 WebContents* fullscreen_tab = chrome::GetActiveWebContents(browser); |
| 5959 FullscreenExitBubbleType type = | 5960 FullscreenExitBubbleType type = |
| 5960 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5961 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5961 browser->OnAcceptFullscreenPermission(fullscreen_tab->GetURL(), type); | 5962 browser->fullscreen_controller()->OnAcceptFullscreenPermission( |
| 5963 fullscreen_tab->GetURL(), type); |
| 5962 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 5964 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 5963 } | 5965 } |
| 5964 | 5966 |
| 5965 void TestingAutomationProvider::DenyCurrentFullscreenOrMouseLockRequest( | 5967 void TestingAutomationProvider::DenyCurrentFullscreenOrMouseLockRequest( |
| 5966 Browser* browser, | 5968 Browser* browser, |
| 5967 base::DictionaryValue* args, | 5969 base::DictionaryValue* args, |
| 5968 IPC::Message* reply_message) { | 5970 IPC::Message* reply_message) { |
| 5969 FullscreenExitBubbleType type = | 5971 FullscreenExitBubbleType type = |
| 5970 browser->fullscreen_controller_->GetFullscreenExitBubbleType(); | 5972 browser->fullscreen_controller()->GetFullscreenExitBubbleType(); |
| 5971 browser->OnDenyFullscreenPermission(type); | 5973 browser->fullscreen_controller()->OnDenyFullscreenPermission(type); |
| 5972 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 5974 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 5973 } | 5975 } |
| 5974 | 5976 |
| 5975 void TestingAutomationProvider::WaitForAllViewsToStopLoading( | 5977 void TestingAutomationProvider::WaitForAllViewsToStopLoading( |
| 5976 DictionaryValue* args, | 5978 DictionaryValue* args, |
| 5977 IPC::Message* reply_message) { | 5979 IPC::Message* reply_message) { |
| 5978 if (AppModalDialogQueue::GetInstance()->HasActiveDialog()) { | 5980 if (AppModalDialogQueue::GetInstance()->HasActiveDialog()) { |
| 5979 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 5981 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 5980 return; | 5982 return; |
| 5981 } | 5983 } |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6767 void TestingAutomationProvider::OnRemoveProvider() { | 6769 void TestingAutomationProvider::OnRemoveProvider() { |
| 6768 if (g_browser_process) | 6770 if (g_browser_process) |
| 6769 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6771 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6770 } | 6772 } |
| 6771 | 6773 |
| 6772 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6774 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6773 WebContents* tab) { | 6775 WebContents* tab) { |
| 6774 if (chrome::GetActiveWebContents(browser) != tab) | 6776 if (chrome::GetActiveWebContents(browser) != tab) |
| 6775 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6777 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 6776 } | 6778 } |
| OLD | NEW |