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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2811793005: Rename LocalFrame::Script() to GetScriptController() (Closed)
Patch Set: Created 3 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 return; 668 return;
669 SubframeLoadingDisabler disabler(GetFrame()->GetDocument()); 669 SubframeLoadingDisabler disabler(GetFrame()->GetDocument());
670 GetFrame()->Loader().DispatchUnloadEvent(); 670 GetFrame()->Loader().DispatchUnloadEvent();
671 } 671 }
672 672
673 void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) { 673 void WebLocalFrameImpl::ExecuteScript(const WebScriptSource& source) {
674 DCHECK(GetFrame()); 674 DCHECK(GetFrame());
675 TextPosition position(OrdinalNumber::FromOneBasedInt(source.start_line), 675 TextPosition position(OrdinalNumber::FromOneBasedInt(source.start_line),
676 OrdinalNumber::First()); 676 OrdinalNumber::First());
677 v8::HandleScope handle_scope(ToIsolate(GetFrame())); 677 v8::HandleScope handle_scope(ToIsolate(GetFrame()));
678 GetFrame()->Script().ExecuteScriptInMainWorld( 678 GetFrame()->GetScriptController().ExecuteScriptInMainWorld(
679 ScriptSourceCode(source.code, source.url, position)); 679 ScriptSourceCode(source.code, source.url, position));
680 } 680 }
681 681
682 void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld( 682 void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld(
683 int world_id, 683 int world_id,
684 const WebScriptSource* sources_in, 684 const WebScriptSource* sources_in,
685 unsigned num_sources) { 685 unsigned num_sources) {
686 DCHECK(GetFrame()); 686 DCHECK(GetFrame());
687 CHECK_GT(world_id, 0); 687 CHECK_GT(world_id, 0);
688 CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit); 688 CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit);
689 689
690 HeapVector<ScriptSourceCode> sources = 690 HeapVector<ScriptSourceCode> sources =
691 CreateSourcesVector(sources_in, num_sources); 691 CreateSourcesVector(sources_in, num_sources);
692 v8::HandleScope handle_scope(ToIsolate(GetFrame())); 692 v8::HandleScope handle_scope(ToIsolate(GetFrame()));
693 GetFrame()->Script().ExecuteScriptInIsolatedWorld(world_id, sources, 0); 693 GetFrame()->GetScriptController().ExecuteScriptInIsolatedWorld(world_id,
694 sources, 0);
694 } 695 }
695 696
696 void WebLocalFrameImpl::SetIsolatedWorldSecurityOrigin( 697 void WebLocalFrameImpl::SetIsolatedWorldSecurityOrigin(
697 int world_id, 698 int world_id,
698 const WebSecurityOrigin& security_origin) { 699 const WebSecurityOrigin& security_origin) {
699 DCHECK(GetFrame()); 700 DCHECK(GetFrame());
700 DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(world_id, 701 DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(world_id,
701 security_origin.Get()); 702 security_origin.Get());
702 } 703 }
703 704
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return; 749 return;
749 V8GCController::CollectGarbage(v8::Isolate::GetCurrent()); 750 V8GCController::CollectGarbage(v8::Isolate::GetCurrent());
750 } 751 }
751 752
752 v8::Local<v8::Value> WebLocalFrameImpl::ExecuteScriptAndReturnValue( 753 v8::Local<v8::Value> WebLocalFrameImpl::ExecuteScriptAndReturnValue(
753 const WebScriptSource& source) { 754 const WebScriptSource& source) {
754 DCHECK(GetFrame()); 755 DCHECK(GetFrame());
755 756
756 TextPosition position(OrdinalNumber::FromOneBasedInt(source.start_line), 757 TextPosition position(OrdinalNumber::FromOneBasedInt(source.start_line),
757 OrdinalNumber::First()); 758 OrdinalNumber::First());
758 return GetFrame()->Script().ExecuteScriptInMainWorldAndReturnValue( 759 return GetFrame()
759 ScriptSourceCode(source.code, source.url, position)); 760 ->GetScriptController()
761 .ExecuteScriptInMainWorldAndReturnValue(
762 ScriptSourceCode(source.code, source.url, position));
760 } 763 }
761 764
762 void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue( 765 void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue(
763 const WebScriptSource& source, 766 const WebScriptSource& source,
764 bool user_gesture, 767 bool user_gesture,
765 WebScriptExecutionCallback* callback) { 768 WebScriptExecutionCallback* callback) {
766 DCHECK(GetFrame()); 769 DCHECK(GetFrame());
767 770
768 RefPtr<DOMWrapperWorld> main_world = &DOMWrapperWorld::MainWorld(); 771 RefPtr<DOMWrapperWorld> main_world = &DOMWrapperWorld::MainWorld();
769 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::Create( 772 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::Create(
(...skipping 22 matching lines...) Expand all
792 WebVector<v8::Local<v8::Value>>* results) { 795 WebVector<v8::Local<v8::Value>>* results) {
793 DCHECK(GetFrame()); 796 DCHECK(GetFrame());
794 CHECK_GT(world_id, 0); 797 CHECK_GT(world_id, 0);
795 CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit); 798 CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit);
796 799
797 HeapVector<ScriptSourceCode> sources = 800 HeapVector<ScriptSourceCode> sources =
798 CreateSourcesVector(sources_in, num_sources); 801 CreateSourcesVector(sources_in, num_sources);
799 802
800 if (results) { 803 if (results) {
801 Vector<v8::Local<v8::Value>> script_results; 804 Vector<v8::Local<v8::Value>> script_results;
802 GetFrame()->Script().ExecuteScriptInIsolatedWorld(world_id, sources, 805 GetFrame()->GetScriptController().ExecuteScriptInIsolatedWorld(
803 &script_results); 806 world_id, sources, &script_results);
804 WebVector<v8::Local<v8::Value>> v8_results(script_results.size()); 807 WebVector<v8::Local<v8::Value>> v8_results(script_results.size());
805 for (unsigned i = 0; i < script_results.size(); i++) 808 for (unsigned i = 0; i < script_results.size(); i++)
806 v8_results[i] = 809 v8_results[i] =
807 v8::Local<v8::Value>::New(ToIsolate(GetFrame()), script_results[i]); 810 v8::Local<v8::Value>::New(ToIsolate(GetFrame()), script_results[i]);
808 results->Swap(v8_results); 811 results->Swap(v8_results);
809 } else { 812 } else {
810 v8::HandleScope handle_scope(ToIsolate(GetFrame())); 813 v8::HandleScope handle_scope(ToIsolate(GetFrame()));
811 GetFrame()->Script().ExecuteScriptInIsolatedWorld(world_id, sources, 0); 814 GetFrame()->GetScriptController().ExecuteScriptInIsolatedWorld(world_id,
815 sources, 0);
812 } 816 }
813 } 817 }
814 818
815 void WebLocalFrameImpl::RequestExecuteScriptInIsolatedWorld( 819 void WebLocalFrameImpl::RequestExecuteScriptInIsolatedWorld(
816 int world_id, 820 int world_id,
817 const WebScriptSource* sources_in, 821 const WebScriptSource* sources_in,
818 unsigned num_sources, 822 unsigned num_sources,
819 bool user_gesture, 823 bool user_gesture,
820 ScriptExecutionType option, 824 ScriptExecutionType option,
821 WebScriptExecutionCallback* callback) { 825 WebScriptExecutionCallback* callback) {
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 if (SchemeRegistry::ShouldTreatURLSchemeAsNotAllowingJavascriptURLs( 1937 if (SchemeRegistry::ShouldTreatURLSchemeAsNotAllowingJavascriptURLs(
1934 GetFrame()->GetDocument()->Url().Protocol())) 1938 GetFrame()->GetDocument()->Url().Protocol()))
1935 return; 1939 return;
1936 1940
1937 String script = DecodeURLEscapeSequences( 1941 String script = DecodeURLEscapeSequences(
1938 url.GetString().Substring(strlen("javascript:"))); 1942 url.GetString().Substring(strlen("javascript:")));
1939 UserGestureIndicator gesture_indicator(DocumentUserGestureToken::Create( 1943 UserGestureIndicator gesture_indicator(DocumentUserGestureToken::Create(
1940 GetFrame()->GetDocument(), UserGestureToken::kNewGesture)); 1944 GetFrame()->GetDocument(), UserGestureToken::kNewGesture));
1941 v8::HandleScope handle_scope(ToIsolate(GetFrame())); 1945 v8::HandleScope handle_scope(ToIsolate(GetFrame()));
1942 v8::Local<v8::Value> result = 1946 v8::Local<v8::Value> result =
1943 GetFrame()->Script().ExecuteScriptInMainWorldAndReturnValue( 1947 GetFrame()->GetScriptController().ExecuteScriptInMainWorldAndReturnValue(
1944 ScriptSourceCode(script)); 1948 ScriptSourceCode(script));
1945 if (result.IsEmpty() || !result->IsString()) 1949 if (result.IsEmpty() || !result->IsString())
1946 return; 1950 return;
1947 String script_result = ToCoreString(v8::Local<v8::String>::Cast(result)); 1951 String script_result = ToCoreString(v8::Local<v8::String>::Cast(result));
1948 if (!GetFrame()->GetNavigationScheduler().LocationChangePending()) 1952 if (!GetFrame()->GetNavigationScheduler().LocationChangePending())
1949 GetFrame()->Loader().ReplaceDocumentWhileExecutingJavaScriptURL( 1953 GetFrame()->Loader().ReplaceDocumentWhileExecutingJavaScriptURL(
1950 script_result, owner_document); 1954 script_result, owner_document);
1951 } 1955 }
1952 1956
1953 HitTestResult WebLocalFrameImpl::HitTestResultForVisualViewportPos( 1957 HitTestResult WebLocalFrameImpl::HitTestResultForVisualViewportPos(
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const { 2562 TextCheckerClient& WebLocalFrameImpl::GetTextCheckerClient() const {
2559 return *text_checker_client_; 2563 return *text_checker_client_;
2560 } 2564 }
2561 2565
2562 void WebLocalFrameImpl::SetTextCheckClient( 2566 void WebLocalFrameImpl::SetTextCheckClient(
2563 WebTextCheckClient* text_check_client) { 2567 WebTextCheckClient* text_check_client) {
2564 text_check_client_ = text_check_client; 2568 text_check_client_ = text_check_client;
2565 } 2569 }
2566 2570
2567 } // namespace blink 2571 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDevToolsFrontendImpl.cpp ('k') | third_party/WebKit/Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698