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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 } | 1620 } |
1621 | 1621 |
1622 ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() | 1622 ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() |
1623 : execute_tab_id_(-1) { | 1623 : execute_tab_id_(-1) { |
1624 } | 1624 } |
1625 | 1625 |
1626 ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} | 1626 ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} |
1627 | 1627 |
1628 bool ExecuteCodeInTabFunction::HasPermission() { | 1628 bool ExecuteCodeInTabFunction::HasPermission() { |
1629 if (Init() && | 1629 if (Init() && |
1630 PermissionsData::ForExtension(extension_) | 1630 extension_->permissions_data()->HasAPIPermissionForTab( |
1631 ->HasAPIPermissionForTab(execute_tab_id_, APIPermission::kTab)) { | 1631 execute_tab_id_, APIPermission::kTab)) { |
1632 return true; | 1632 return true; |
1633 } | 1633 } |
1634 return ExtensionFunction::HasPermission(); | 1634 return ExtensionFunction::HasPermission(); |
1635 } | 1635 } |
1636 | 1636 |
1637 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { | 1637 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
1638 content::WebContents* contents = NULL; | 1638 content::WebContents* contents = NULL; |
1639 | 1639 |
1640 // If |tab_id| is specified, look for the tab. Otherwise default to selected | 1640 // If |tab_id| is specified, look for the tab. Otherwise default to selected |
1641 // tab in the current window. | 1641 // tab in the current window. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 execute_tab_id_ = tab_id; | 1744 execute_tab_id_ = tab_id; |
1745 details_ = details.Pass(); | 1745 details_ = details.Pass(); |
1746 return true; | 1746 return true; |
1747 } | 1747 } |
1748 | 1748 |
1749 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 1749 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
1750 return true; | 1750 return true; |
1751 } | 1751 } |
1752 | 1752 |
1753 } // namespace extensions | 1753 } // namespace extensions |
OLD | NEW |