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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 24 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
25 #include "chrome/browser/extensions/api/tabs/windows_util.h" | 25 #include "chrome/browser/extensions/api/tabs/windows_util.h" |
26 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
27 #include "chrome/browser/extensions/extension_tab_util.h" | 27 #include "chrome/browser/extensions/extension_tab_util.h" |
28 #include "chrome/browser/extensions/tab_helper.h" | 28 #include "chrome/browser/extensions/tab_helper.h" |
29 #include "chrome/browser/extensions/window_controller.h" | 29 #include "chrome/browser/extensions/window_controller.h" |
30 #include "chrome/browser/extensions/window_controller_list.h" | 30 #include "chrome/browser/extensions/window_controller_list.h" |
31 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 31 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/sessions/session_tab_helper.h" |
33 #include "chrome/browser/translate/chrome_translate_client.h" | 34 #include "chrome/browser/translate/chrome_translate_client.h" |
34 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 35 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
35 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_commands.h" | 37 #include "chrome/browser/ui/browser_commands.h" |
37 #include "chrome/browser/ui/browser_finder.h" | 38 #include "chrome/browser/ui/browser_finder.h" |
38 #include "chrome/browser/ui/browser_iterator.h" | 39 #include "chrome/browser/ui/browser_iterator.h" |
39 #include "chrome/browser/ui/browser_navigator.h" | 40 #include "chrome/browser/ui/browser_navigator.h" |
40 #include "chrome/browser/ui/browser_tabstrip.h" | 41 #include "chrome/browser/ui/browser_tabstrip.h" |
41 #include "chrome/browser/ui/browser_window.h" | 42 #include "chrome/browser/ui/browser_window.h" |
42 #include "chrome/browser/ui/host_desktop.h" | 43 #include "chrome/browser/ui/host_desktop.h" |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 Browser* browser = GetCurrentBrowser(); | 1081 Browser* browser = GetCurrentBrowser(); |
1081 if (!browser) { | 1082 if (!browser) { |
1082 error_ = keys::kNoCurrentWindowError; | 1083 error_ = keys::kNoCurrentWindowError; |
1083 return false; | 1084 return false; |
1084 } | 1085 } |
1085 contents = browser->tab_strip_model()->GetActiveWebContents(); | 1086 contents = browser->tab_strip_model()->GetActiveWebContents(); |
1086 if (!contents) { | 1087 if (!contents) { |
1087 error_ = keys::kNoSelectedTabError; | 1088 error_ = keys::kNoSelectedTabError; |
1088 return false; | 1089 return false; |
1089 } | 1090 } |
1090 tab_id = SessionID::IdForTab(contents); | 1091 tab_id = SessionTabHelper::IdForTab(contents); |
1091 } else { | 1092 } else { |
1092 tab_id = *params->tab_id; | 1093 tab_id = *params->tab_id; |
1093 } | 1094 } |
1094 | 1095 |
1095 int tab_index = -1; | 1096 int tab_index = -1; |
1096 TabStripModel* tab_strip = NULL; | 1097 TabStripModel* tab_strip = NULL; |
1097 if (!GetTabById(tab_id, | 1098 if (!GetTabById(tab_id, |
1098 GetProfile(), | 1099 GetProfile(), |
1099 include_incognito(), | 1100 include_incognito(), |
1100 NULL, | 1101 NULL, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 if (!GetBrowserFromWindowID(this, window_id, &browser)) | 1511 if (!GetBrowserFromWindowID(this, window_id, &browser)) |
1511 return NULL; | 1512 return NULL; |
1512 | 1513 |
1513 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); | 1514 WebContents* contents = browser->tab_strip_model()->GetActiveWebContents(); |
1514 if (!contents) { | 1515 if (!contents) { |
1515 error_ = keys::kInternalVisibleTabCaptureError; | 1516 error_ = keys::kInternalVisibleTabCaptureError; |
1516 return NULL; | 1517 return NULL; |
1517 } | 1518 } |
1518 | 1519 |
1519 if (!extension()->permissions_data()->CanCaptureVisiblePage( | 1520 if (!extension()->permissions_data()->CanCaptureVisiblePage( |
1520 SessionID::IdForTab(contents), &error_)) { | 1521 SessionTabHelper::IdForTab(contents), &error_)) { |
1521 return NULL; | 1522 return NULL; |
1522 } | 1523 } |
1523 return contents; | 1524 return contents; |
1524 } | 1525 } |
1525 | 1526 |
1526 void TabsCaptureVisibleTabFunction::OnCaptureFailure(FailureReason reason) { | 1527 void TabsCaptureVisibleTabFunction::OnCaptureFailure(FailureReason reason) { |
1527 error_ = keys::kInternalVisibleTabCaptureError; | 1528 error_ = keys::kInternalVisibleTabCaptureError; |
1528 SendResponse(false); | 1529 SendResponse(false); |
1529 } | 1530 } |
1530 | 1531 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); | 1896 ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode(); |
1896 api::tabs::ZoomSettings zoom_settings; | 1897 api::tabs::ZoomSettings zoom_settings; |
1897 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 1898 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
1898 | 1899 |
1899 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 1900 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
1900 SendResponse(true); | 1901 SendResponse(true); |
1901 return true; | 1902 return true; |
1902 } | 1903 } |
1903 | 1904 |
1904 } // namespace extensions | 1905 } // namespace extensions |
OLD | NEW |