OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 5865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5876 AutomationJSONReply(this, reply_message) | 5876 AutomationJSONReply(this, reply_message) |
5877 .SendError("'path' missing or invalid"); | 5877 .SendError("'path' missing or invalid"); |
5878 return; | 5878 return; |
5879 } | 5879 } |
5880 | 5880 |
5881 RenderViewHost* render_view = web_contents->GetRenderViewHost(); | 5881 RenderViewHost* render_view = web_contents->GetRenderViewHost(); |
5882 if (render_view) { | 5882 if (render_view) { |
5883 FilePath path(path_str); | 5883 FilePath path(path_str); |
5884 // This will delete itself when finished. | 5884 // This will delete itself when finished. |
5885 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( | 5885 PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( |
5886 this, reply_message, TabContents::FromWebContents(web_contents), path); | 5886 this, reply_message, web_contents, path); |
5887 snapshot_taker->Start(); | 5887 snapshot_taker->Start(); |
5888 } else { | 5888 } else { |
5889 AutomationJSONReply(this, reply_message) | 5889 AutomationJSONReply(this, reply_message) |
5890 .SendError("Tab has no associated RenderViewHost"); | 5890 .SendError("Tab has no associated RenderViewHost"); |
5891 } | 5891 } |
5892 } | 5892 } |
5893 | 5893 |
5894 void TestingAutomationProvider::GetCookiesJSON( | 5894 void TestingAutomationProvider::GetCookiesJSON( |
5895 DictionaryValue* args, IPC::Message* reply_message) { | 5895 DictionaryValue* args, IPC::Message* reply_message) { |
5896 automation_util::GetCookiesJSON(this, args, reply_message); | 5896 automation_util::GetCookiesJSON(this, args, reply_message); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6339 | 6339 |
6340 NavigationController* controller = tab_tracker_->GetResource(tab_handle); | 6340 NavigationController* controller = tab_tracker_->GetResource(tab_handle); |
6341 if (!controller) { | 6341 if (!controller) { |
6342 AutomationMsg_WaitForInfoBarCount::WriteReplyParams(reply_message_, false); | 6342 AutomationMsg_WaitForInfoBarCount::WriteReplyParams(reply_message_, false); |
6343 Send(reply_message_); | 6343 Send(reply_message_); |
6344 return; | 6344 return; |
6345 } | 6345 } |
6346 | 6346 |
6347 // The delegate will delete itself. | 6347 // The delegate will delete itself. |
6348 new InfoBarCountObserver(this, reply_message, | 6348 new InfoBarCountObserver(this, reply_message, |
6349 TabContents::FromWebContents(controller->GetWebContents()), target_count); | 6349 controller->GetWebContents(), target_count); |
6350 } | 6350 } |
6351 | 6351 |
6352 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( | 6352 void TestingAutomationProvider::WaitForProcessLauncherThreadToGoIdle( |
6353 IPC::Message* reply_message) { | 6353 IPC::Message* reply_message) { |
6354 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); | 6354 new WaitForProcessLauncherThreadToGoIdleObserver(this, reply_message); |
6355 } | 6355 } |
6356 | 6356 |
6357 void TestingAutomationProvider::OnRemoveProvider() { | 6357 void TestingAutomationProvider::OnRemoveProvider() { |
6358 if (g_browser_process) | 6358 if (g_browser_process) |
6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6360 } | 6360 } |
6361 | 6361 |
6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6363 WebContents* tab) { | 6363 WebContents* tab) { |
6364 TabStripModel* tab_strip = browser->tab_strip_model(); | 6364 TabStripModel* tab_strip = browser->tab_strip_model(); |
6365 if (tab_strip->GetActiveWebContents() != tab) | 6365 if (tab_strip->GetActiveWebContents() != tab) |
6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
6367 } | 6367 } |
OLD | NEW |