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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 Release(); // Balanced in Run() | 1960 Release(); // Balanced in Run() |
1961 } | 1961 } |
1962 | 1962 |
1963 ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() | 1963 ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() |
1964 : execute_tab_id_(-1) { | 1964 : execute_tab_id_(-1) { |
1965 } | 1965 } |
1966 | 1966 |
1967 ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} | 1967 ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} |
1968 | 1968 |
1969 bool ExecuteCodeInTabFunction::HasPermission() { | 1969 bool ExecuteCodeInTabFunction::HasPermission() { |
1970 if (Init() && | 1970 if (Init() && PermissionsData::HasAPIPermissionForTab( |
1971 PermissionsData::HasAPIPermissionForTab( | 1971 extension_.get(), execute_tab_id_, APIPermission::kTab)) { |
1972 extension_, execute_tab_id_, APIPermission::kTab)) { | |
1973 return true; | 1972 return true; |
1974 } | 1973 } |
1975 return ExtensionFunction::HasPermission(); | 1974 return ExtensionFunction::HasPermission(); |
1976 } | 1975 } |
1977 | 1976 |
1978 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { | 1977 bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() { |
1979 content::WebContents* contents = NULL; | 1978 content::WebContents* contents = NULL; |
1980 | 1979 |
1981 // If |tab_id| is specified, look for the tab. Otherwise default to selected | 1980 // If |tab_id| is specified, look for the tab. Otherwise default to selected |
1982 // tab in the current window. | 1981 // tab in the current window. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 execute_tab_id_ = tab_id; | 2067 execute_tab_id_ = tab_id; |
2069 details_ = details.Pass(); | 2068 details_ = details.Pass(); |
2070 return true; | 2069 return true; |
2071 } | 2070 } |
2072 | 2071 |
2073 bool TabsInsertCSSFunction::ShouldInsertCSS() const { | 2072 bool TabsInsertCSSFunction::ShouldInsertCSS() const { |
2074 return true; | 2073 return true; |
2075 } | 2074 } |
2076 | 2075 |
2077 } // namespace extensions | 2076 } // namespace extensions |
OLD | NEW |