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

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

Issue 2899743002: Remove raw base::DictionaryValue::Set in //extensions (Closed)
Patch Set: Addressed nit Created 3 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/user_metrics.h" 11 #include "base/metrics/user_metrics.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/values.h"
14 #include "components/guest_view/browser/guest_view_event.h" 15 #include "components/guest_view/browser/guest_view_event.h"
15 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
16 #include "content/public/browser/render_view_host.h" 17 #include "content/public/browser/render_view_host.h"
17 #include "extensions/browser/api/extensions_api_client.h" 18 #include "extensions/browser/api/extensions_api_client.h"
18 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 19 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
19 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 20 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
20 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h" 21 #include "extensions/browser/guest_view/web_view/web_view_permission_helper_dele gate.h"
21 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" 22 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
22 #include "ppapi/features/features.h" 23 #include "ppapi/features/features.h"
23 24
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // in the same scope without fear of use after freeing. 324 // in the same scope without fear of use after freeing.
324 base::ThreadTaskRunnerHandle::Get()->PostTask( 325 base::ThreadTaskRunnerHandle::Get()->PostTask(
325 FROM_HERE, base::Bind(callback, allowed_by_default, std::string())); 326 FROM_HERE, base::Bind(callback, allowed_by_default, std::string()));
326 return webview::kInvalidPermissionRequestID; 327 return webview::kInvalidPermissionRequestID;
327 } 328 }
328 329
329 int request_id = next_permission_request_id_++; 330 int request_id = next_permission_request_id_++;
330 pending_permission_requests_[request_id] = 331 pending_permission_requests_[request_id] =
331 PermissionResponseInfo(callback, permission_type, allowed_by_default); 332 PermissionResponseInfo(callback, permission_type, allowed_by_default);
332 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 333 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
333 args->Set(webview::kRequestInfo, request_info.DeepCopy()); 334 args->Set(webview::kRequestInfo, base::MakeUnique<base::Value>(request_info));
334 args->SetInteger(webview::kRequestId, request_id); 335 args->SetInteger(webview::kRequestId, request_id);
335 switch (permission_type) { 336 switch (permission_type) {
336 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { 337 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: {
337 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( 338 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>(
338 webview::kEventNewWindow, std::move(args))); 339 webview::kEventNewWindow, std::move(args)));
339 break; 340 break;
340 } 341 }
341 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { 342 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: {
342 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( 343 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>(
343 webview::kEventDialog, std::move(args))); 344 webview::kEventDialog, std::move(args)));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 allowed_by_default(allowed_by_default) { 405 allowed_by_default(allowed_by_default) {
405 } 406 }
406 407
407 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( 408 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo(
408 const PermissionResponseInfo& other) = default; 409 const PermissionResponseInfo& other) = default;
409 410
410 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { 411 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() {
411 } 412 }
412 413
413 } // namespace extensions 414 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_find_helper.cc ('k') | extensions/browser/value_store/value_store_change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698