| 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (!MatchesBool(params->query_info.audible.get(), | 981 if (!MatchesBool(params->query_info.audible.get(), |
| 982 web_contents->WasRecentlyAudible())) { | 982 web_contents->WasRecentlyAudible())) { |
| 983 continue; | 983 continue; |
| 984 } | 984 } |
| 985 | 985 |
| 986 if (!MatchesBool(params->query_info.muted.get(), | 986 if (!MatchesBool(params->query_info.muted.get(), |
| 987 web_contents->IsAudioMuted())) { | 987 web_contents->IsAudioMuted())) { |
| 988 continue; | 988 continue; |
| 989 } | 989 } |
| 990 | 990 |
| 991 // "title" and "url" properties are considered privileged data and can | 991 if (!title.empty() || !url_patterns.is_empty()) { |
| 992 // only be checked if the extension has the "tabs" permission. Otherwise, | 992 // "title" and "url" properties are considered privileged data and can |
| 993 // these properties are ignored. | 993 // only be checked if the extension has the "tabs" permission or it has |
| 994 if (extension_->permissions_data()->HasAPIPermissionForTab( | 994 // access to the WebContents's origin. Otherwise, this tab is considered |
| 995 ExtensionTabUtil::GetTabId(web_contents), APIPermission::kTab)) { | 995 // not matched. |
| 996 if (!extension_->permissions_data()->HasAPIPermissionForTab( |
| 997 ExtensionTabUtil::GetTabId(web_contents), |
| 998 APIPermission::kTab) && |
| 999 !extension_->permissions_data()->HasHostPermission( |
| 1000 web_contents->GetURL())) { |
| 1001 continue; |
| 1002 } |
| 1003 |
| 996 if (!title.empty() && | 1004 if (!title.empty() && |
| 997 !base::MatchPattern(web_contents->GetTitle(), | 1005 !base::MatchPattern(web_contents->GetTitle(), |
| 998 base::UTF8ToUTF16(title))) | 1006 base::UTF8ToUTF16(title))) { |
| 999 continue; | 1007 continue; |
| 1008 } |
| 1000 | 1009 |
| 1001 if (!url_patterns.is_empty() && | 1010 if (!url_patterns.is_empty() && |
| 1002 !url_patterns.MatchesURL(web_contents->GetURL())) | 1011 !url_patterns.MatchesURL(web_contents->GetURL())) { |
| 1003 continue; | 1012 continue; |
| 1013 } |
| 1004 } | 1014 } |
| 1005 | 1015 |
| 1006 if (loading_status_set && loading != web_contents->IsLoading()) | 1016 if (loading_status_set && loading != web_contents->IsLoading()) |
| 1007 continue; | 1017 continue; |
| 1008 | 1018 |
| 1009 result->Append(ExtensionTabUtil::CreateTabValue( | 1019 result->Append(ExtensionTabUtil::CreateTabValue( |
| 1010 web_contents, tab_strip, i, extension())); | 1020 web_contents, tab_strip, i, extension())); |
| 1011 } | 1021 } |
| 1012 } | 1022 } |
| 1013 | 1023 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); | 2065 ZoomModeToZoomSettings(zoom_mode, &zoom_settings); |
| 2056 zoom_settings.default_zoom_factor.reset(new double( | 2066 zoom_settings.default_zoom_factor.reset(new double( |
| 2057 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); | 2067 content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()))); |
| 2058 | 2068 |
| 2059 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); | 2069 results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings); |
| 2060 SendResponse(true); | 2070 SendResponse(true); |
| 2061 return true; | 2071 return true; |
| 2062 } | 2072 } |
| 2063 | 2073 |
| 2064 } // namespace extensions | 2074 } // namespace extensions |
| OLD | NEW |