| 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 | |
| 9 #include <algorithm> | 8 #include <algorithm> |
| 10 #include <limits> | 9 #include <limits> |
| 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/ref_counted_memory.h" | 17 #include "base/memory/ref_counted_memory.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| (...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 if (tab_id == -1) { | 1816 if (tab_id == -1) { |
| 1817 Browser* browser = chrome_details_.GetCurrentBrowser(); | 1817 Browser* browser = chrome_details_.GetCurrentBrowser(); |
| 1818 if (!browser) | 1818 if (!browser) |
| 1819 return false; | 1819 return false; |
| 1820 content::WebContents* web_contents = NULL; | 1820 content::WebContents* web_contents = NULL; |
| 1821 if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) | 1821 if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id)) |
| 1822 return false; | 1822 return false; |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 execute_tab_id_ = tab_id; | 1825 execute_tab_id_ = tab_id; |
| 1826 details_ = details.Pass(); | 1826 details_ = std::move(details); |
| 1827 set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); | 1827 set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); |
| 1828 return true; | 1828 return true; |
| 1829 } | 1829 } |
| 1830 | 1830 |
| 1831 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { | 1831 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
| 1832 content::WebContents* contents = NULL; | 1832 content::WebContents* contents = NULL; |
| 1833 | 1833 |
| 1834 // If |tab_id| is specified, look for the tab. Otherwise default to selected | 1834 // If |tab_id| is specified, look for the tab. Otherwise default to selected |
| 1835 // tab in the current window. | 1835 // tab in the current window. |
| 1836 CHECK_GE(execute_tab_id_, 0); | 1836 CHECK_GE(execute_tab_id_, 0); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 2048 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
| 2049 zoom_settings.default_zoom_factor.reset(new double( | 2049 zoom_settings.default_zoom_factor.reset(new double( |
| 2050 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 2050 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
| 2051 | 2051 |
| 2052 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 2052 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
| 2053 SendResponse(true); | 2053 SendResponse(true); |
| 2054 return true; | 2054 return true; |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 } // namespace extensions | 2057 } // namespace extensions |
| OLD | NEW |