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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp

Issue 2848653003: Add a DevTools command to create an isolated world for a given frame (Closed)
Patch Set: Rebased Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 .setPageX(AdjustScrollForAbsoluteZoom(page_offset.Width(), page_zoom)) 902 .setPageX(AdjustScrollForAbsoluteZoom(page_offset.Width(), page_zoom))
903 .setPageY( 903 .setPageY(
904 AdjustScrollForAbsoluteZoom(page_offset.Height(), page_zoom)) 904 AdjustScrollForAbsoluteZoom(page_offset.Height(), page_zoom))
905 .setClientWidth(visible_rect.Width() - scrollbar_width) 905 .setClientWidth(visible_rect.Width() - scrollbar_width)
906 .setClientHeight(visible_rect.Height() - scrollbar_height) 906 .setClientHeight(visible_rect.Height() - scrollbar_height)
907 .setScale(scale) 907 .setScale(scale)
908 .build(); 908 .build();
909 return Response::OK(); 909 return Response::OK();
910 } 910 }
911 911
912 protocol::Response InspectorPageAgent::createIsolatedWorld(
913 const String& frame_id,
914 Maybe<String> world_name,
915 Maybe<bool> grant_universal_access) {
916 LocalFrame* frame =
917 IdentifiersFactory::FrameById(inspected_frames_, frame_id);
918 if (!frame)
919 return Response::Error("No frame for given id found");
920
921 int world_id = frame->GetScriptController().CreateNewDInspectorIsolatedWorld(
922 world_name.fromMaybe(""));
923 if (world_id == DOMWrapperWorld::kInvalidWorldId)
924 return Response::Error("Could not create isolated world");
925
926 if (grant_universal_access.fromMaybe(false)) {
927 RefPtr<SecurityOrigin> security_origin =
928 frame->GetSecurityContext()->GetSecurityOrigin()->IsolatedCopy();
929 security_origin->GrantUniversalAccess();
930 DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(world_id, security_origin);
931 }
932 return Response::OK();
933 }
934
912 DEFINE_TRACE(InspectorPageAgent) { 935 DEFINE_TRACE(InspectorPageAgent) {
913 visitor->Trace(inspected_frames_); 936 visitor->Trace(inspected_frames_);
914 visitor->Trace(inspector_resource_content_loader_); 937 visitor->Trace(inspector_resource_content_loader_);
915 InspectorBaseAgent::Trace(visitor); 938 InspectorBaseAgent::Trace(visitor);
916 } 939 }
917 940
918 } // namespace blink 941 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698