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

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

Issue 265503003: Enable file_handlers and chrome.app.runtime for QuickOffice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback, less hacky Created 6 years, 7 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::HasAPIPermissionForTab( 92 if (!PermissionsData::HasAPIPermissionForTab(
93 extension, tab_id, APIPermission::kTabCaptureForTab) && 93 extension, tab_id, APIPermission::kTabCaptureForTab) &&
94 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 94 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
95 switches::kWhitelistedExtensionID) != extension_id && 95 switches::kWhitelistedExtensionID) != extension_id &&
96 !SimpleFeature::IsIdInWhitelist( 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 }
104 104
105 content::RenderViewHost* const rvh = target_contents->GetRenderViewHost(); 105 content::RenderViewHost* const rvh = target_contents->GetRenderViewHost();
106 int render_process_id = rvh->GetProcess()->GetID(); 106 int render_process_id = rvh->GetProcess()->GetID();
(...skipping 70 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

Powered by Google App Engine
This is Rietveld 408576698