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

Side by Side Diff: chrome/browser/extensions/api/tab_capture/tab_capture_api.cc

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 // Implements the Chrome Extensions Tab Capture API. 5 // Implements the Chrome Extensions Tab Capture API.
6 6
7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h" 7 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h"
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return false; 82 return false;
83 } 83 }
84 84
85 const Extension* extension = GetExtension(); 85 const Extension* extension = GetExtension();
86 const std::string& extension_id = extension->id(); 86 const std::string& extension_id = extension->id();
87 87
88 const int tab_id = SessionID::IdForTab(target_contents); 88 const int tab_id = SessionID::IdForTab(target_contents);
89 89
90 // Make sure either we have been granted permission to capture through an 90 // Make sure either we have been granted permission to capture through an
91 // extension icon click or our extension is whitelisted. 91 // extension icon click or our extension is whitelisted.
92 if (!PermissionsData::ForExtension(extension) 92 if (!extension->permissions_data()->HasAPIPermissionForTab(
93 ->HasAPIPermissionForTab(tab_id, APIPermission::kTabCaptureForTab) && 93 tab_id, APIPermission::kTabCaptureForTab) &&
94 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 94 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
95 switches::kWhitelistedExtensionID) != extension_id && 95 switches::kWhitelistedExtensionID) != extension_id &&
96 !SimpleFeature::IsIdInList( 96 !SimpleFeature::IsIdInList(
97 extension_id, 97 extension_id,
98 std::set<std::string>( 98 std::set<std::string>(
99 whitelisted_extensions, 99 whitelisted_extensions,
100 whitelisted_extensions + arraysize(whitelisted_extensions)))) { 100 whitelisted_extensions + arraysize(whitelisted_extensions)))) {
101 error_ = kGrantError; 101 error_ = kGrantError;
102 return false; 102 return false;
103 } 103 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 info->tab_id = it->first; 177 info->tab_id = it->first;
178 info->status = it->second; 178 info->status = it->second;
179 list->Append(info->ToValue().release()); 179 list->Append(info->ToValue().release());
180 } 180 }
181 181
182 SetResult(list); 182 SetResult(list);
183 return true; 183 return true;
184 } 184 }
185 185
186 } // namespace extensions 186 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/media_galleries/media_galleries_api.cc ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698