| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/automation/automation_browser_tracker.h" | 10 #include "chrome/browser/automation/automation_browser_tracker.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // This message expects no response. | 299 // This message expects no response. |
| 300 } | 300 } |
| 301 | 301 |
| 302 void AutomationProvider::PrintAsync(int tab_handle) { | 302 void AutomationProvider::PrintAsync(int tab_handle) { |
| 303 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, NULL); | 303 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, NULL); |
| 304 if (!tab_contents) | 304 if (!tab_contents) |
| 305 return; | 305 return; |
| 306 | 306 |
| 307 TabContentsWrapper* wrapper = | 307 TabContentsWrapper* wrapper = |
| 308 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 308 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 309 wrapper->print_view_manager()->PrintNow(); | 309 wrapper->print_view_manager()->PrintNow(NULL); |
| 310 } | 310 } |
| 311 | 311 |
| 312 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { | 312 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { |
| 313 if (tab_tracker_->ContainsHandle(handle)) { | 313 if (tab_tracker_->ContainsHandle(handle)) { |
| 314 NavigationController* tab = tab_tracker_->GetResource(handle); | 314 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 315 return ExternalTabContainer::GetContainerForTab( | 315 return ExternalTabContainer::GetContainerForTab( |
| 316 tab->tab_contents()->GetNativeView()); | 316 tab->tab_contents()->GetNativeView()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 return NULL; | 319 return NULL; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { | 463 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { |
| 464 if (tab_tracker_->ContainsHandle(handle)) { | 464 if (tab_tracker_->ContainsHandle(handle)) { |
| 465 NavigationController* tab = tab_tracker_->GetResource(handle); | 465 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 466 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { | 466 if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { |
| 467 RenderViewHost* host = tab->tab_contents()->render_view_host(); | 467 RenderViewHost* host = tab->tab_contents()->render_view_host(); |
| 468 PageZoom::Function zoom = static_cast<PageZoom::Function>(zoom_level); | 468 PageZoom::Function zoom = static_cast<PageZoom::Function>(zoom_level); |
| 469 host->Send(new ViewMsg_Zoom(host->routing_id(), zoom)); | 469 host->Send(new ViewMsg_Zoom(host->routing_id(), zoom)); |
| 470 } | 470 } |
| 471 } | 471 } |
| 472 } | 472 } |
| OLD | NEW |