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

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

Issue 1010973013: Refactor Uses of std::set to std::vector in SimpleFeature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Unsigned From Checks with STLCount Created 5 years, 9 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 const std::string& extension_id = extension()->id(); 85 const std::string& extension_id = extension()->id();
86 86
87 // Make sure either we have been granted permission to capture through an 87 // Make sure either we have been granted permission to capture through an
88 // extension icon click or our extension is whitelisted. 88 // extension icon click or our extension is whitelisted.
89 if (!extension()->permissions_data()->HasAPIPermissionForTab( 89 if (!extension()->permissions_data()->HasAPIPermissionForTab(
90 SessionTabHelper::IdForTab(target_contents), 90 SessionTabHelper::IdForTab(target_contents),
91 APIPermission::kTabCaptureForTab) && 91 APIPermission::kTabCaptureForTab) &&
92 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 92 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
93 switches::kWhitelistedExtensionID) != extension_id && 93 switches::kWhitelistedExtensionID) != extension_id &&
94 !SimpleFeature::IsIdInList( 94 !SimpleFeature::IsIdInArray(
95 extension_id, 95 extension_id, kWhitelist, arraysize(kWhitelist))) {
96 std::set<std::string>(kWhitelist,
97 kWhitelist + arraysize(kWhitelist)))) {
98 error_ = kGrantError; 96 error_ = kGrantError;
99 return false; 97 return false;
100 } 98 }
101 99
102 // Create a constraints vector. We will modify all the constraints in this 100 // Create a constraints vector. We will modify all the constraints in this
103 // vector to append our chrome specific constraints. 101 // vector to append our chrome specific constraints.
104 std::vector<MediaStreamConstraint*> constraints; 102 std::vector<MediaStreamConstraint*> constraints;
105 bool has_audio = params->options.audio.get() && *params->options.audio.get(); 103 bool has_audio = params->options.audio.get() && *params->options.audio.get();
106 bool has_video = params->options.video.get() && *params->options.video.get(); 104 bool has_video = params->options.video.get() && *params->options.video.get();
107 105
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool TabCaptureGetCapturedTabsFunction::RunSync() { 157 bool TabCaptureGetCapturedTabsFunction::RunSync() {
160 TabCaptureRegistry* registry = TabCaptureRegistry::Get(GetProfile()); 158 TabCaptureRegistry* registry = TabCaptureRegistry::Get(GetProfile());
161 base::ListValue* const list = new base::ListValue(); 159 base::ListValue* const list = new base::ListValue();
162 if (registry) 160 if (registry)
163 registry->GetCapturedTabs(extension()->id(), list); 161 registry->GetCapturedTabs(extension()->id(), list);
164 SetResult(list); 162 SetResult(list);
165 return true; 163 return true;
166 } 164 }
167 165
168 } // namespace extensions 166 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698