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

Side by Side Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 10675007: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase again Created 8 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
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/ui/extensions/shell_window.h" 5 #include "chrome/browser/ui/extensions/shell_window.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/extensions/shell_window_registry.h" 9 #include "chrome/browser/extensions/shell_window_registry.h"
10 #include "chrome/browser/file_select_helper.h" 10 #include "chrome/browser/file_select_helper.h"
(...skipping 25 matching lines...) Expand all
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_intents_dispatcher.h" 37 #include "content/public/browser/web_intents_dispatcher.h"
38 #include "content/public/common/renderer_preferences.h" 38 #include "content/public/common/renderer_preferences.h"
39 39
40 using content::BrowserThread; 40 using content::BrowserThread;
41 using content::ConsoleMessageLevel; 41 using content::ConsoleMessageLevel;
42 using content::RenderViewHost; 42 using content::RenderViewHost;
43 using content::ResourceDispatcherHost; 43 using content::ResourceDispatcherHost;
44 using content::SiteInstance; 44 using content::SiteInstance;
45 using content::WebContents; 45 using content::WebContents;
46 using extensions::APIPermission;
46 47
47 namespace { 48 namespace {
48 const int kDefaultWidth = 512; 49 const int kDefaultWidth = 512;
49 const int kDefaultHeight = 384; 50 const int kDefaultHeight = 384;
50 51
51 void SuspendRenderViewHost(RenderViewHost* rvh) { 52 void SuspendRenderViewHost(RenderViewHost* rvh) {
52 DCHECK(rvh); 53 DCHECK(rvh);
53 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 54 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
54 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, 55 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute,
55 base::Unretained(ResourceDispatcherHost::Get()), 56 base::Unretained(ResourceDispatcherHost::Get()),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 149
149 void ShellWindow::RequestMediaAccessPermission( 150 void ShellWindow::RequestMediaAccessPermission(
150 content::WebContents* web_contents, 151 content::WebContents* web_contents,
151 const content::MediaStreamRequest* request, 152 const content::MediaStreamRequest* request,
152 const content::MediaResponseCallback& callback) { 153 const content::MediaResponseCallback& callback) {
153 content::MediaStreamDevices devices; 154 content::MediaStreamDevices devices;
154 155
155 content::MediaStreamDeviceMap::const_iterator iter = 156 content::MediaStreamDeviceMap::const_iterator iter =
156 request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE); 157 request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE);
157 if (iter != request->devices.end() && 158 if (iter != request->devices.end() &&
158 extension()->HasAPIPermission(ExtensionAPIPermission::kAudioCapture) && 159 extension()->HasAPIPermission(APIPermission::kAudioCapture) &&
159 !iter->second.empty()) { 160 !iter->second.empty()) {
160 devices.push_back(iter->second[0]); 161 devices.push_back(iter->second[0]);
161 } 162 }
162 163
163 iter = request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); 164 iter = request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE);
164 if (iter != request->devices.end() && 165 if (iter != request->devices.end() &&
165 extension()->HasAPIPermission(ExtensionAPIPermission::kVideoCapture) && 166 extension()->HasAPIPermission(APIPermission::kVideoCapture) &&
166 !iter->second.empty()) { 167 !iter->second.empty()) {
167 devices.push_back(iter->second[0]); 168 devices.push_back(iter->second[0]);
168 } 169 }
169 170
170 callback.Run(devices); 171 callback.Run(devices);
171 } 172 }
172 173
173 WebContents* ShellWindow::OpenURLFromTab(WebContents* source, 174 WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
174 const content::OpenURLParams& params) { 175 const content::OpenURLParams& params) {
175 DCHECK(source == web_contents_); 176 DCHECK(source == web_contents_);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 extension_function_dispatcher_.Dispatch(params, 350 extension_function_dispatcher_.Dispatch(params,
350 web_contents_->GetRenderViewHost()); 351 web_contents_->GetRenderViewHost());
351 } 352 }
352 353
353 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, 354 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
354 const std::string& message) { 355 const std::string& message) {
355 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 356 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
356 rvh->Send(new ExtensionMsg_AddMessageToConsole( 357 rvh->Send(new ExtensionMsg_AddMessageToConsole(
357 rvh->GetRoutingID(), level, message)); 358 rvh->GetRoutingID(), level, message));
358 } 359 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698