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

Side by Side Diff: chrome/browser/guestview/webview/webview_guest.cc

Issue 235633002: <webview>: Move Geolocation permission to chrome layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reordered permission names Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/guestview/webview/webview_guest.h" 5 #include "chrome/browser/guestview/webview/webview_guest.h"
6 6
7 #include "base/message_loop/message_loop.h"
7 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 10 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
10 #include "chrome/browser/extensions/api/webview/webview_api.h" 11 #include "chrome/browser/extensions/api/webview/webview_api.h"
11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 12 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
12 #include "chrome/browser/extensions/extension_renderer_state.h" 13 #include "chrome/browser/extensions/extension_renderer_state.h"
13 #include "chrome/browser/extensions/menu_manager.h" 14 #include "chrome/browser/extensions/menu_manager.h"
14 #include "chrome/browser/extensions/script_executor.h" 15 #include "chrome/browser/extensions/script_executor.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 16 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/guestview/guestview_constants.h" 17 #include "chrome/browser/guestview/guestview_constants.h"
17 #include "chrome/browser/guestview/webview/webview_constants.h" 18 #include "chrome/browser/guestview/webview/webview_constants.h"
18 #include "chrome/browser/guestview/webview/webview_permission_types.h" 19 #include "chrome/browser/guestview/webview/webview_permission_types.h"
19 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
20 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/geolocation_permission_context.h"
21 #include "content/public/browser/native_web_keyboard_event.h" 23 #include "content/public/browser/native_web_keyboard_event.h"
22 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
23 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
26 #include "content/public/browser/notification_types.h" 28 #include "content/public/browser/notification_types.h"
27 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/resource_request_details.h" 30 #include "content/public/browser/resource_request_details.h"
29 #include "content/public/browser/site_instance.h" 31 #include "content/public/browser/site_instance.h"
30 #include "content/public/browser/storage_partition.h" 32 #include "content/public/browser/storage_partition.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 break; 70 break;
69 } 71 }
70 NOTREACHED() << "Unknown Termination Status."; 72 NOTREACHED() << "Unknown Termination Status.";
71 return "unknown"; 73 return "unknown";
72 } 74 }
73 75
74 static std::string PermissionTypeToString(BrowserPluginPermissionType type) { 76 static std::string PermissionTypeToString(BrowserPluginPermissionType type) {
75 switch (type) { 77 switch (type) {
76 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD: 78 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD:
77 return webview::kPermissionTypeDownload; 79 return webview::kPermissionTypeDownload;
78 case BROWSER_PLUGIN_PERMISSION_TYPE_GEOLOCATION:
79 return webview::kPermissionTypeGeolocation;
80 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA: 80 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA:
81 return webview::kPermissionTypeMedia; 81 return webview::kPermissionTypeMedia;
82 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: 82 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW:
83 return webview::kPermissionTypeNewWindow; 83 return webview::kPermissionTypeNewWindow;
84 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK: 84 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK:
85 return webview::kPermissionTypePointerLock; 85 return webview::kPermissionTypePointerLock;
86 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: 86 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG:
87 return webview::kPermissionTypeDialog; 87 return webview::kPermissionTypeDialog;
88 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN: 88 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN:
89 NOTREACHED(); 89 NOTREACHED();
90 break; 90 break;
91 default: { 91 default: {
92 WebViewPermissionType webview = static_cast<WebViewPermissionType>(type); 92 WebViewPermissionType webview = static_cast<WebViewPermissionType>(type);
93 switch (webview) { 93 switch (webview) {
94 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION:
95 return webview::kPermissionTypeGeolocation;
94 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: 96 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN:
95 return webview::kPermissionTypeLoadPlugin; 97 return webview::kPermissionTypeLoadPlugin;
96 } 98 }
97 NOTREACHED(); 99 NOTREACHED();
98 } 100 }
99 } 101 }
100 return std::string(); 102 return std::string();
101 } 103 }
102 104
103 void RemoveWebViewEventListenersOnIOThread( 105 void RemoveWebViewEventListenersOnIOThread(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (allow) { 188 if (allow) {
187 // Note that |allow| == true means the embedder explicitly allowed the 189 // Note that |allow| == true means the embedder explicitly allowed the
188 // request. For some requests they might still fail. An example of such 190 // request. For some requests they might still fail. An example of such
189 // scenario would be: an embedder allows geolocation request but doesn't 191 // scenario would be: an embedder allows geolocation request but doesn't
190 // have geolocation access on its own. 192 // have geolocation access on its own.
191 switch (info.permission_type) { 193 switch (info.permission_type) {
192 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD: 194 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD:
193 content::RecordAction( 195 content::RecordAction(
194 UserMetricsAction("BrowserPlugin.PermissionAllow.Download")); 196 UserMetricsAction("BrowserPlugin.PermissionAllow.Download"));
195 break; 197 break;
196 case BROWSER_PLUGIN_PERMISSION_TYPE_GEOLOCATION:
197 content::RecordAction(
198 UserMetricsAction("BrowserPlugin.PermissionAllow.Geolocation"));
199 break;
200 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA: 198 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA:
201 content::RecordAction( 199 content::RecordAction(
202 UserMetricsAction("BrowserPlugin.PermissionAllow.Media")); 200 UserMetricsAction("BrowserPlugin.PermissionAllow.Media"));
203 break; 201 break;
204 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK: 202 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK:
205 content::RecordAction( 203 content::RecordAction(
206 UserMetricsAction("BrowserPlugin.PermissionAllow.PointerLock")); 204 UserMetricsAction("BrowserPlugin.PermissionAllow.PointerLock"));
207 break; 205 break;
208 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: 206 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW:
209 content::RecordAction( 207 content::RecordAction(
210 UserMetricsAction("BrowserPlugin.PermissionAllow.NewWindow")); 208 UserMetricsAction("BrowserPlugin.PermissionAllow.NewWindow"));
211 break; 209 break;
212 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: 210 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG:
213 content::RecordAction( 211 content::RecordAction(
214 UserMetricsAction("BrowserPlugin.PermissionAllow.JSDialog")); 212 UserMetricsAction("BrowserPlugin.PermissionAllow.JSDialog"));
215 break; 213 break;
216 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN: 214 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN:
217 break; 215 break;
218 default: { 216 default: {
219 WebViewPermissionType webview_permission_type = 217 WebViewPermissionType webview_permission_type =
220 static_cast<WebViewPermissionType>(info.permission_type); 218 static_cast<WebViewPermissionType>(info.permission_type);
221 switch (webview_permission_type) { 219 switch (webview_permission_type) {
220 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION:
221 content::RecordAction(
222 UserMetricsAction("WebView.PermissionAllow.Geolocation"));
223 break;
222 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: 224 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN:
223 content::RecordAction( 225 content::RecordAction(
224 UserMetricsAction("WebView.Guest.PermissionAllow.PluginLoad")); 226 UserMetricsAction("WebView.Guest.PermissionAllow.PluginLoad"));
225 break; 227 break;
226 default: 228 default:
227 break; 229 break;
228 } 230 }
229 } 231 }
230 } 232 }
231 } else { 233 } else {
232 switch (info.permission_type) { 234 switch (info.permission_type) {
233 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD: 235 case BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD:
234 content::RecordAction( 236 content::RecordAction(
235 UserMetricsAction("BrowserPlugin.PermissionDeny.Download")); 237 UserMetricsAction("BrowserPlugin.PermissionDeny.Download"));
236 break; 238 break;
237 case BROWSER_PLUGIN_PERMISSION_TYPE_GEOLOCATION:
238 content::RecordAction(
239 UserMetricsAction("BrowserPlugin.PermissionDeny.Geolocation"));
240 break;
241 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA: 239 case BROWSER_PLUGIN_PERMISSION_TYPE_MEDIA:
242 content::RecordAction( 240 content::RecordAction(
243 UserMetricsAction("BrowserPlugin.PermissionDeny.Media")); 241 UserMetricsAction("BrowserPlugin.PermissionDeny.Media"));
244 break; 242 break;
245 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK: 243 case BROWSER_PLUGIN_PERMISSION_TYPE_POINTER_LOCK:
246 content::RecordAction( 244 content::RecordAction(
247 UserMetricsAction("BrowserPlugin.PermissionDeny.PointerLock")); 245 UserMetricsAction("BrowserPlugin.PermissionDeny.PointerLock"));
248 break; 246 break;
249 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: 247 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW:
250 content::RecordAction( 248 content::RecordAction(
251 UserMetricsAction("BrowserPlugin.PermissionDeny.NewWindow")); 249 UserMetricsAction("BrowserPlugin.PermissionDeny.NewWindow"));
252 break; 250 break;
253 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: 251 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG:
254 content::RecordAction( 252 content::RecordAction(
255 UserMetricsAction("BrowserPlugin.PermissionDeny.JSDialog")); 253 UserMetricsAction("BrowserPlugin.PermissionDeny.JSDialog"));
256 break; 254 break;
257 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN: 255 case BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN:
258 break; 256 break;
259 default: { 257 default: {
260 WebViewPermissionType webview_permission_type = 258 WebViewPermissionType webview_permission_type =
261 static_cast<WebViewPermissionType>(info.permission_type); 259 static_cast<WebViewPermissionType>(info.permission_type);
262 switch (webview_permission_type) { 260 switch (webview_permission_type) {
261 case WEB_VIEW_PERMISSION_TYPE_GEOLOCATION:
262 content::RecordAction(
263 UserMetricsAction("WebView.PermissionDeny.Geolocation"));
264 break;
263 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN: 265 case WEB_VIEW_PERMISSION_TYPE_LOAD_PLUGIN:
264 content::RecordAction( 266 content::RecordAction(
265 UserMetricsAction("WebView.Guest.PermissionDeny.PluginLoad")); 267 UserMetricsAction("WebView.Guest.PermissionDeny.PluginLoad"));
266 break; 268 break;
267 default: 269 default:
268 break; 270 break;
269 } 271 }
270 } 272 }
271 } 273 }
272 } 274 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 DispatchEvent(new GuestView::Event(webview::kEventResponsive, args.Pass())); 432 DispatchEvent(new GuestView::Event(webview::kEventResponsive, args.Pass()));
431 } 433 }
432 434
433 void WebViewGuest::RendererUnresponsive() { 435 void WebViewGuest::RendererUnresponsive() {
434 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 436 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
435 args->SetInteger(webview::kProcessId, 437 args->SetInteger(webview::kProcessId,
436 guest_web_contents()->GetRenderProcessHost()->GetID()); 438 guest_web_contents()->GetRenderProcessHost()->GetID());
437 DispatchEvent(new GuestView::Event(webview::kEventUnresponsive, args.Pass())); 439 DispatchEvent(new GuestView::Event(webview::kEventUnresponsive, args.Pass()));
438 } 440 }
439 441
440 bool WebViewGuest::RequestPermission( 442 int WebViewGuest::RequestPermission(
441 BrowserPluginPermissionType permission_type, 443 BrowserPluginPermissionType permission_type,
442 const base::DictionaryValue& request_info, 444 const base::DictionaryValue& request_info,
443 const PermissionResponseCallback& callback, 445 const PermissionResponseCallback& callback,
444 bool allowed_by_default) { 446 bool allowed_by_default) {
445 // If there are too many pending permission requests then reject this request. 447 // If there are too many pending permission requests then reject this request.
446 if (pending_permission_requests_.size() >= 448 if (pending_permission_requests_.size() >=
447 webview::kMaxOutstandingPermissionRequests) { 449 webview::kMaxOutstandingPermissionRequests) {
448 callback.Run(false, std::string()); 450 // Let the stack unwind before we deny the permission request so that
449 return true; 451 // objects held by the permission request are not destroyed immediately
452 // after creation. This is to allow those same objects to be accessed again
453 // in the same scope without fear of use after freeing.
454 base::MessageLoop::current()->PostTask(
455 FROM_HERE,
456 base::Bind(&PermissionResponseCallback::Run,
457 base::Owned(new PermissionResponseCallback(callback)),
458 allowed_by_default,
459 std::string()));
460 return webview::kInvalidPermissionRequestID;
450 } 461 }
451 462
452 int request_id = next_permission_request_id_++; 463 int request_id = next_permission_request_id_++;
453 pending_permission_requests_[request_id] = 464 pending_permission_requests_[request_id] =
454 PermissionResponseInfo(callback, permission_type, allowed_by_default); 465 PermissionResponseInfo(callback, permission_type, allowed_by_default);
455 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); 466 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy());
456 args->SetInteger(webview::kRequestId, request_id); 467 args->SetInteger(webview::kRequestId, request_id);
457 switch (permission_type) { 468 switch (permission_type) {
458 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: { 469 case BROWSER_PLUGIN_PERMISSION_TYPE_NEW_WINDOW: {
459 DispatchEvent(new GuestView::Event(webview::kEventNewWindow, 470 DispatchEvent(new GuestView::Event(webview::kEventNewWindow,
460 args.Pass())); 471 args.Pass()));
461 break; 472 break;
462 } 473 }
463 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { 474 case BROWSER_PLUGIN_PERMISSION_TYPE_JAVASCRIPT_DIALOG: {
464 DispatchEvent(new GuestView::Event(webview::kEventDialog, 475 DispatchEvent(new GuestView::Event(webview::kEventDialog,
465 args.Pass())); 476 args.Pass()));
466 break; 477 break;
467 } 478 }
468 default: { 479 default: {
469 args->SetString(webview::kPermission, 480 args->SetString(webview::kPermission,
470 PermissionTypeToString(permission_type)); 481 PermissionTypeToString(permission_type));
471 DispatchEvent(new GuestView::Event(webview::kEventPermissionRequest, 482 DispatchEvent(new GuestView::Event(webview::kEventPermissionRequest,
472 args.Pass())); 483 args.Pass()));
473 break; 484 break;
474 } 485 }
475 } 486 }
476 return true; 487 return request_id;
477 } 488 }
478 489
479 void WebViewGuest::Observe(int type, 490 void WebViewGuest::Observe(int type,
480 const content::NotificationSource& source, 491 const content::NotificationSource& source,
481 const content::NotificationDetails& details) { 492 const content::NotificationDetails& details) {
482 switch (type) { 493 switch (type) {
483 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { 494 case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
484 DCHECK_EQ(content::Source<WebContents>(source).ptr(), 495 DCHECK_EQ(content::Source<WebContents>(source).ptr(),
485 guest_web_contents()); 496 guest_web_contents());
486 if (content::Source<WebContents>(source).ptr() == guest_web_contents()) 497 if (content::Source<WebContents>(source).ptr() == guest_web_contents())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 guest_web_contents()->GetController().GoToOffset(relative_index); 548 guest_web_contents()->GetController().GoToOffset(relative_index);
538 } 549 }
539 550
540 void WebViewGuest::Reload() { 551 void WebViewGuest::Reload() {
541 // TODO(fsamuel): Don't check for repost because we don't want to show 552 // TODO(fsamuel): Don't check for repost because we don't want to show
542 // Chromium's repost warning. We might want to implement a separate API 553 // Chromium's repost warning. We might want to implement a separate API
543 // for registering a callback if a repost is about to happen. 554 // for registering a callback if a repost is about to happen.
544 guest_web_contents()->GetController().Reload(false); 555 guest_web_contents()->GetController().Reload(false);
545 } 556 }
546 557
558
lazyboy 2014/04/11 22:00:53 nit: remove empty line.
559 void WebViewGuest::RequestGeolocationPermission(
560 int bridge_id,
561 const GURL& requesting_frame,
562 bool user_gesture,
563 const base::Callback<void(bool)>& callback) {
564 base::DictionaryValue request_info;
565 request_info.Set(guestview::kUrl,
566 base::Value::CreateStringValue(requesting_frame.spec()));
567 request_info.Set(guestview::kUserGesture,
568 base::Value::CreateBooleanValue(user_gesture));
569 int request_id = RequestPermission(
570 static_cast<BrowserPluginPermissionType>(
571 WEB_VIEW_PERMISSION_TYPE_GEOLOCATION),
572 request_info,
573 base::Bind(&WebViewGuest::OnWebViewGeolocationPermissionResponse,
574 base::Unretained(this),
lazyboy 2014/04/11 21:47:21 Same question like the other CL, what if WebViewGu
Fady Samuel 2014/04/11 21:57:16 WebViewGuest::SetPermission calls the bound method
lazyboy 2014/04/11 22:00:53 Cool, can we add a quick comment here then.
Fady Samuel 2014/04/14 17:30:02 Done.
575 bridge_id,
576 user_gesture,
577 callback),
578 false /* allowed_by_default */);
579 bridge_id_to_request_id_map_[bridge_id] = request_id;
580 }
581
582 void WebViewGuest::OnWebViewGeolocationPermissionResponse(
583 int bridge_id,
584 bool user_gesture,
585 const base::Callback<void(bool)>& callback,
586 bool allow,
587 const std::string& user_input) {
588 // The <webview> embedder has allowed the permission. We now need to make sure
589 // that the embedder has geolocation permission.
590 RemoveBridgeID(bridge_id);
591
592 if (!allow || !attached()) {
593 callback.Run(false);
594 return;
595 }
596
597 content::GeolocationPermissionContext* geolocation_context =
598 browser_context()->GetGeolocationPermissionContext();
599
600 DCHECK(geolocation_context);
601 geolocation_context->RequestGeolocationPermission(
602 embedder_web_contents()->GetRenderProcessHost()->GetID(),
603 embedder_web_contents()->GetRoutingID(),
604 // The geolocation permission request here is not initiated
605 // through WebGeolocationPermissionRequest. We are only interested
606 // in the fact whether the embedder/app has geolocation
607 // permission. Therefore we use an invalid |bridge_id|.
608 -1 /* bridge_id */,
609 embedder_web_contents()->GetLastCommittedURL(),
610 user_gesture,
611 callback);
612 }
613
614 void WebViewGuest::CancelGeolocationPermissionRequest(int bridge_id) {
615 int request_id = RemoveBridgeID(bridge_id);
616 RequestMap::iterator request_itr =
617 pending_permission_requests_.find(request_id);
618
619 if (request_itr == pending_permission_requests_.end())
620 return;
621
622 pending_permission_requests_.erase(request_itr);
623 }
624
547 WebViewGuest::SetPermissionResult WebViewGuest::SetPermission( 625 WebViewGuest::SetPermissionResult WebViewGuest::SetPermission(
548 int request_id, 626 int request_id,
549 PermissionResponseAction action, 627 PermissionResponseAction action,
550 const std::string& user_input) { 628 const std::string& user_input) {
551 RequestMap::iterator request_itr = 629 RequestMap::iterator request_itr =
552 pending_permission_requests_.find(request_id); 630 pending_permission_requests_.find(request_id);
553 631
554 if (request_itr == pending_permission_requests_.end()) 632 if (request_itr == pending_permission_requests_.end())
555 return SET_PERMISSION_INVALID; 633 return SET_PERMISSION_INVALID;
556 634
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 chromeos::AccessibilityManager* manager = 889 chromeos::AccessibilityManager* manager =
812 chromeos::AccessibilityManager::Get(); 890 chromeos::AccessibilityManager::Get();
813 if (manager && manager->IsSpokenFeedbackEnabled()) { 891 if (manager && manager->IsSpokenFeedbackEnabled()) {
814 manager->InjectChromeVox(render_view_host); 892 manager->InjectChromeVox(render_view_host);
815 chromevox_injected_ = true; 893 chromevox_injected_ = true;
816 } 894 }
817 } 895 }
818 #endif 896 #endif
819 } 897 }
820 898
899 int WebViewGuest::RemoveBridgeID(int bridge_id) {
900 std::map<int, int>::iterator bridge_itr =
901 bridge_id_to_request_id_map_.find(bridge_id);
902 if (bridge_itr == bridge_id_to_request_id_map_.end())
903 return webview::kInvalidPermissionRequestID;
904
905 int request_id = bridge_itr->second;
906 bridge_id_to_request_id_map_.erase(bridge_itr);
907 return request_id;
908 }
909
910
lazyboy 2014/04/11 21:47:21 remove empty line
Fady Samuel 2014/04/11 21:57:16 Done.
821 WebViewGuest::PermissionResponseInfo::PermissionResponseInfo() 911 WebViewGuest::PermissionResponseInfo::PermissionResponseInfo()
822 : permission_type(BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN), 912 : permission_type(BROWSER_PLUGIN_PERMISSION_TYPE_UNKNOWN),
823 allowed_by_default(false) { 913 allowed_by_default(false) {
824 } 914 }
825 915
826 WebViewGuest::PermissionResponseInfo::PermissionResponseInfo( 916 WebViewGuest::PermissionResponseInfo::PermissionResponseInfo(
827 const PermissionResponseCallback& callback, 917 const PermissionResponseCallback& callback,
828 BrowserPluginPermissionType permission_type, 918 BrowserPluginPermissionType permission_type,
829 bool allowed_by_default) 919 bool allowed_by_default)
830 : callback(callback), 920 : callback(callback),
831 permission_type(permission_type), 921 permission_type(permission_type),
832 allowed_by_default(allowed_by_default) { 922 allowed_by_default(allowed_by_default) {
833 } 923 }
834 924
835 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { 925 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() {
836 } 926 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698