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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 461 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
462 } | 462 } |
463 | 463 |
464 bool AutomationProvider::Send(IPC::Message* msg) { | 464 bool AutomationProvider::Send(IPC::Message* msg) { |
465 DCHECK(channel_.get()); | 465 DCHECK(channel_.get()); |
466 return channel_->Send(msg); | 466 return channel_->Send(msg); |
467 } | 467 } |
468 | 468 |
469 Browser* AutomationProvider::FindAndActivateTab( | 469 Browser* AutomationProvider::FindAndActivateTab( |
470 NavigationController* controller) { | 470 NavigationController* controller) { |
471 int tab_index; | 471 content::WebContentsDelegate* d = controller->GetWebContents()->GetDelegate(); |
472 Browser* browser = browser::FindBrowserForController(controller, &tab_index); | 472 if (d) |
473 if (browser) | 473 d->ActivateContents(controller->GetWebContents()); |
474 chrome::ActivateTabAt(browser, tab_index, true); | 474 return browser::FindBrowserWithWebContents(controller->GetWebContents()); |
475 return browser; | |
476 } | 475 } |
477 | 476 |
478 void AutomationProvider::HandleFindRequest( | 477 void AutomationProvider::HandleFindRequest( |
479 int handle, | 478 int handle, |
480 const AutomationMsg_Find_Params& params, | 479 const AutomationMsg_Find_Params& params, |
481 IPC::Message* reply_message) { | 480 IPC::Message* reply_message) { |
482 if (!tab_tracker_->ContainsHandle(handle)) { | 481 if (!tab_tracker_->ContainsHandle(handle)) { |
483 AutomationMsg_Find::WriteReplyParams(reply_message, -1, -1); | 482 AutomationMsg_Find::WriteReplyParams(reply_message, -1, -1); |
484 Send(reply_message); | 483 Send(reply_message); |
485 return; | 484 return; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 | 749 |
751 return NULL; | 750 return NULL; |
752 } | 751 } |
753 | 752 |
754 void AutomationProvider::SaveAsAsync(int tab_handle) { | 753 void AutomationProvider::SaveAsAsync(int tab_handle) { |
755 NavigationController* tab = NULL; | 754 NavigationController* tab = NULL; |
756 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); | 755 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab); |
757 if (web_contents) | 756 if (web_contents) |
758 web_contents->OnSavePage(); | 757 web_contents->OnSavePage(); |
759 } | 758 } |
OLD | NEW |