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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_permission_helper.cc

Issue 1087123002: Towards Decoupling GuestView from Extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed lazyboy@'s comments. Removed unnecessary includes. Simplified GuestViewEvent. Created 5 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
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.cc ('k') | extensions/extensions.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_permission_helper.h" 5 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
6 6
7 #include "content/public/browser/render_process_host.h" 7 #include "content/public/browser/render_process_host.h"
8 #include "content/public/browser/render_view_host.h" 8 #include "content/public/browser/render_view_host.h"
9 #include "content/public/browser/user_metrics.h" 9 #include "content/public/browser/user_metrics.h"
10 #include "extensions/browser/api/extensions_api_client.h" 10 #include "extensions/browser/api/extensions_api_client.h"
11 #include "extensions/browser/guest_view/guest_view_event.h"
11 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 12 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
12 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 13 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
13 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h" 14 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h"
14 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" 15 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
15 16
16 using content::BrowserPluginGuestDelegate; 17 using content::BrowserPluginGuestDelegate;
17 using content::RenderViewHost; 18 using content::RenderViewHost;
18 19
19 namespace extensions { 20 namespace extensions {
20 21
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 324 }
324 325
325 int request_id = next_permission_request_id_++; 326 int request_id = next_permission_request_id_++;
326 pending_permission_requests_[request_id] = 327 pending_permission_requests_[request_id] =
327 PermissionResponseInfo(callback, permission_type, allowed_by_default); 328 PermissionResponseInfo(callback, permission_type, allowed_by_default);
328 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); 329 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy());
329 args->SetInteger(webview::kRequestId, request_id); 330 args->SetInteger(webview::kRequestId, request_id);
330 switch (permission_type) { 331 switch (permission_type) {
331 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { 332 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: {
332 web_view_guest_->DispatchEventToView( 333 web_view_guest_->DispatchEventToView(
333 new GuestViewBase::Event(webview::kEventNewWindow, args.Pass())); 334 new GuestViewEvent(webview::kEventNewWindow, args.Pass()));
334 break; 335 break;
335 } 336 }
336 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { 337 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: {
337 web_view_guest_->DispatchEventToView( 338 web_view_guest_->DispatchEventToView(
338 new GuestViewBase::Event(webview::kEventDialog, args.Pass())); 339 new GuestViewEvent(webview::kEventDialog, args.Pass()));
339 break; 340 break;
340 } 341 }
341 default: { 342 default: {
342 args->SetString(webview::kPermission, 343 args->SetString(webview::kPermission,
343 PermissionTypeToString(permission_type)); 344 PermissionTypeToString(permission_type));
344 web_view_guest_->DispatchEventToView(new GuestViewBase::Event( 345 web_view_guest_->DispatchEventToView(new GuestViewEvent(
345 webview::kEventPermissionRequest, args.Pass())); 346 webview::kEventPermissionRequest, args.Pass()));
346 break; 347 break;
347 } 348 }
348 } 349 }
349 return request_id; 350 return request_id;
350 } 351 }
351 352
352 WebViewPermissionHelper::SetPermissionResult 353 WebViewPermissionHelper::SetPermissionResult
353 WebViewPermissionHelper::SetPermission( 354 WebViewPermissionHelper::SetPermission(
354 int request_id, 355 int request_id,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 bool allowed_by_default) 397 bool allowed_by_default)
397 : callback(callback), 398 : callback(callback),
398 permission_type(permission_type), 399 permission_type(permission_type),
399 allowed_by_default(allowed_by_default) { 400 allowed_by_default(allowed_by_default) {
400 } 401 }
401 402
402 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { 403 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() {
403 } 404 }
404 405
405 } // namespace extensions 406 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.cc ('k') | extensions/extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698