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

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: 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 19 matching lines...) Expand all
30 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/render_view_host.h" 31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/site_instance.h" 32 #include "content/public/browser/site_instance.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
34 #include "content/public/browser/web_intents_dispatcher.h" 34 #include "content/public/browser/web_intents_dispatcher.h"
35 #include "content/public/common/renderer_preferences.h" 35 #include "content/public/common/renderer_preferences.h"
36 36
37 using content::ConsoleMessageLevel; 37 using content::ConsoleMessageLevel;
38 using content::SiteInstance; 38 using content::SiteInstance;
39 using content::WebContents; 39 using content::WebContents;
40 using extensions::APIPermission;
40 41
41 namespace { 42 namespace {
42 static const int kDefaultWidth = 512; 43 static const int kDefaultWidth = 512;
43 static const int kDefaultHeight = 384; 44 static const int kDefaultHeight = 384;
44 } // namespace 45 } // namespace
45 46
46 ShellWindow::CreateParams::CreateParams() 47 ShellWindow::CreateParams::CreateParams()
47 : frame(ShellWindow::CreateParams::FRAME_CHROME), 48 : frame(ShellWindow::CreateParams::FRAME_CHROME),
48 bounds(10, 10, kDefaultWidth, kDefaultHeight) { 49 bounds(10, 10, kDefaultWidth, kDefaultHeight) {
49 } 50 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 118
118 void ShellWindow::RequestMediaAccessPermission( 119 void ShellWindow::RequestMediaAccessPermission(
119 content::WebContents* web_contents, 120 content::WebContents* web_contents,
120 const content::MediaStreamRequest* request, 121 const content::MediaStreamRequest* request,
121 const content::MediaResponseCallback& callback) { 122 const content::MediaResponseCallback& callback) {
122 content::MediaStreamDevices devices; 123 content::MediaStreamDevices devices;
123 124
124 content::MediaStreamDeviceMap::const_iterator iter = 125 content::MediaStreamDeviceMap::const_iterator iter =
125 request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE); 126 request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE);
126 if (iter != request->devices.end() && 127 if (iter != request->devices.end() &&
127 extension()->HasAPIPermission(ExtensionAPIPermission::kAudioCapture) && 128 extension()->HasAPIPermission(APIPermission::kAudioCapture) &&
128 !iter->second.empty()) { 129 !iter->second.empty()) {
129 devices.push_back(iter->second[0]); 130 devices.push_back(iter->second[0]);
130 } 131 }
131 132
132 iter = request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE); 133 iter = request->devices.find(content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE);
133 if (iter != request->devices.end() && 134 if (iter != request->devices.end() &&
134 extension()->HasAPIPermission(ExtensionAPIPermission::kVideoCapture) && 135 extension()->HasAPIPermission(APIPermission::kVideoCapture) &&
135 !iter->second.empty()) { 136 !iter->second.empty()) {
136 devices.push_back(iter->second[0]); 137 devices.push_back(iter->second[0]);
137 } 138 }
138 139
139 callback.Run(devices); 140 callback.Run(devices);
140 } 141 }
141 142
142 WebContents* ShellWindow::OpenURLFromTab(WebContents* source, 143 WebContents* ShellWindow::OpenURLFromTab(WebContents* source,
143 const content::OpenURLParams& params) { 144 const content::OpenURLParams& params) {
144 DCHECK(source == web_contents_); 145 DCHECK(source == web_contents_);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 extension_function_dispatcher_.Dispatch(params, 309 extension_function_dispatcher_.Dispatch(params,
309 web_contents_->GetRenderViewHost()); 310 web_contents_->GetRenderViewHost());
310 } 311 }
311 312
312 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level, 313 void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
313 const std::string& message) { 314 const std::string& message) {
314 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 315 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
315 rvh->Send(new ExtensionMsg_AddMessageToConsole( 316 rvh->Send(new ExtensionMsg_AddMessageToConsole(
316 rvh->GetRoutingID(), level, message)); 317 rvh->GetRoutingID(), level, message));
317 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698