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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 external_tab->FocusThroughTabTraversal(reverse, restore_focus_to_view); | 234 external_tab->FocusThroughTabTraversal(reverse, restore_focus_to_view); |
235 } | 235 } |
236 // This message expects no response. | 236 // This message expects no response. |
237 } | 237 } |
238 | 238 |
239 void AutomationProvider::PrintAsync(int tab_handle) { | 239 void AutomationProvider::PrintAsync(int tab_handle) { |
240 WebContents* web_contents = GetWebContentsForHandle(tab_handle, NULL); | 240 WebContents* web_contents = GetWebContentsForHandle(tab_handle, NULL); |
241 if (!web_contents) | 241 if (!web_contents) |
242 return; | 242 return; |
243 | 243 |
244 TabContents* tab_contents = | 244 TabContents* tab_contents = TabContents::FromWebContents(web_contents); |
245 TabContents::GetOwningTabContentsForWebContents(web_contents); | |
246 tab_contents->print_view_manager()->PrintNow(); | 245 tab_contents->print_view_manager()->PrintNow(); |
247 } | 246 } |
248 | 247 |
249 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { | 248 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { |
250 if (tab_tracker_->ContainsHandle(handle)) { | 249 if (tab_tracker_->ContainsHandle(handle)) { |
251 NavigationController* tab = tab_tracker_->GetResource(handle); | 250 NavigationController* tab = tab_tracker_->GetResource(handle); |
252 return ExternalTabContainer::GetContainerForTab( | 251 return ExternalTabContainer::GetContainerForTab( |
253 tab->GetWebContents()->GetNativeView()); | 252 tab->GetWebContents()->GetNativeView()); |
254 } | 253 } |
255 | 254 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { | 401 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { |
403 if (tab_tracker_->ContainsHandle(handle)) { | 402 if (tab_tracker_->ContainsHandle(handle)) { |
404 NavigationController* tab = tab_tracker_->GetResource(handle); | 403 NavigationController* tab = tab_tracker_->GetResource(handle); |
405 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { | 404 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { |
406 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); | 405 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); |
407 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); | 406 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); |
408 host->Zoom(zoom); | 407 host->Zoom(zoom); |
409 } | 408 } |
410 } | 409 } |
411 } | 410 } |
OLD | NEW |