| 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/extensions/api/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 | 1660 |
| 1661 bool TabsCaptureVisibleTabFunction::IsScreenshotEnabled() { | 1661 bool TabsCaptureVisibleTabFunction::IsScreenshotEnabled() { |
| 1662 PrefService* service = chrome_details_.GetProfile()->GetPrefs(); | 1662 PrefService* service = chrome_details_.GetProfile()->GetPrefs(); |
| 1663 if (service->GetBoolean(prefs::kDisableScreenshots)) { | 1663 if (service->GetBoolean(prefs::kDisableScreenshots)) { |
| 1664 error_ = keys::kScreenshotsDisabled; | 1664 error_ = keys::kScreenshotsDisabled; |
| 1665 return false; | 1665 return false; |
| 1666 } | 1666 } |
| 1667 return true; | 1667 return true; |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 bool TabsCaptureVisibleTabFunction::ClientAllowsTransparency() { |
| 1671 return false; |
| 1672 } |
| 1673 |
| 1670 WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) { | 1674 WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) { |
| 1671 Browser* browser = NULL; | 1675 Browser* browser = NULL; |
| 1672 if (!GetBrowserFromWindowID(&chrome_details_, window_id, &browser)) | 1676 if (!GetBrowserFromWindowID(&chrome_details_, window_id, &browser)) |
| 1673 return NULL; | 1677 return NULL; |
| 1674 | 1678 |
| 1675 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 1679 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 1676 if (!contents) { | 1680 if (!contents) { |
| 1677 error_ = "No active web contents to capture"; | 1681 error_ = "No active web contents to capture"; |
| 1678 return NULL; | 1682 return NULL; |
| 1679 } | 1683 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2136 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 2140 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
| 2137 zoom_settings.default_zoom_factor.reset(new double( | 2141 zoom_settings.default_zoom_factor.reset(new double( |
| 2138 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 2142 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
| 2139 | 2143 |
| 2140 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 2144 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
| 2141 SendResponse(true); | 2145 SendResponse(true); |
| 2142 return true; | 2146 return true; |
| 2143 } | 2147 } |
| 2144 | 2148 |
| 2145 } // namespace extensions | 2149 } // namespace extensions |
| OLD | NEW |