| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 external_tab->FocusThroughTabTraversal(reverse, restore_focus_to_view); | 252 external_tab->FocusThroughTabTraversal(reverse, restore_focus_to_view); |
| 253 } | 253 } |
| 254 // This message expects no response. | 254 // This message expects no response. |
| 255 } | 255 } |
| 256 | 256 |
| 257 void AutomationProvider::PrintAsync(int tab_handle) { | 257 void AutomationProvider::PrintAsync(int tab_handle) { |
| 258 WebContents* web_contents = GetWebContentsForHandle(tab_handle, NULL); | 258 WebContents* web_contents = GetWebContentsForHandle(tab_handle, NULL); |
| 259 if (!web_contents) | 259 if (!web_contents) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 TabContents* tab_contents = TabContents::FromWebContents(web_contents); | 262 printing::PrintViewManager* print_view_manager = |
| 263 tab_contents->print_view_manager()->PrintNow(); | 263 printing::PrintViewManager::FromWebContents(web_contents); |
| 264 print_view_manager->PrintNow(); |
| 264 } | 265 } |
| 265 | 266 |
| 266 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { | 267 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { |
| 267 if (tab_tracker_->ContainsHandle(handle)) { | 268 if (tab_tracker_->ContainsHandle(handle)) { |
| 268 NavigationController* tab = tab_tracker_->GetResource(handle); | 269 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 269 return ExternalTabContainer::GetContainerForTab( | 270 return ExternalTabContainer::GetContainerForTab( |
| 270 tab->GetWebContents()->GetNativeView()); | 271 tab->GetWebContents()->GetNativeView()); |
| 271 } | 272 } |
| 272 | 273 |
| 273 return NULL; | 274 return NULL; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { | 421 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { |
| 421 if (tab_tracker_->ContainsHandle(handle)) { | 422 if (tab_tracker_->ContainsHandle(handle)) { |
| 422 NavigationController* tab = tab_tracker_->GetResource(handle); | 423 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 423 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { | 424 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { |
| 424 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); | 425 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); |
| 425 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); | 426 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); |
| 426 host->Zoom(zoom); | 427 host->Zoom(zoom); |
| 427 } | 428 } |
| 428 } | 429 } |
| 429 } | 430 } |
| OLD | NEW |