Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 1600553006: chrome.tabs.query: Allow extensions with host permission to see tabs of that host. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mistake while addressing comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698