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

Side by Side Diff: content/shell/test_runner/spell_check_client.cc

Issue 2923053002: Move MainWorldScriptContext accessor/method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Rebasing... 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
« no previous file with comments | « content/shell/test_runner/gc_controller.cc ('k') | content/shell/test_runner/test_interfaces.h » ('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 "content/shell/test_runner/spell_check_client.h" 5 #include "content/shell/test_runner/spell_check_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "content/shell/test_runner/mock_grammar_check.h" 13 #include "content/shell/test_runner/mock_grammar_check.h"
14 #include "content/shell/test_runner/test_runner.h" 14 #include "content/shell/test_runner/test_runner.h"
15 #include "content/shell/test_runner/web_test_delegate.h" 15 #include "content/shell/test_runner/web_test_delegate.h"
16 #include "third_party/WebKit/public/web/WebFrame.h"
17 #include "third_party/WebKit/public/web/WebKit.h" 16 #include "third_party/WebKit/public/web/WebKit.h"
17 #include "third_party/WebKit/public/web/WebLocalFrame.h"
18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h" 18 #include "third_party/WebKit/public/web/WebTextCheckingCompletion.h"
19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h" 19 #include "third_party/WebKit/public/web/WebTextCheckingResult.h"
20 20
21 namespace test_runner { 21 namespace test_runner {
22 22
23 SpellCheckClient::SpellCheckClient(TestRunner* test_runner) 23 SpellCheckClient::SpellCheckClient(TestRunner* test_runner)
24 : last_requested_text_checking_completion_(nullptr), 24 : last_requested_text_checking_completion_(nullptr),
25 test_runner_(test_runner), 25 test_runner_(test_runner),
26 weak_factory_(this) { 26 weak_factory_(this) {
27 DCHECK(test_runner); 27 DCHECK(test_runner);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void SpellCheckClient::RequestResolved() { 141 void SpellCheckClient::RequestResolved() {
142 if (resolved_callback_.IsEmpty()) 142 if (resolved_callback_.IsEmpty())
143 return; 143 return;
144 144
145 v8::Isolate* isolate = blink::MainThreadIsolate(); 145 v8::Isolate* isolate = blink::MainThreadIsolate();
146 v8::HandleScope handle_scope(isolate); 146 v8::HandleScope handle_scope(isolate);
147 147
148 blink::WebFrame* frame = test_runner_->mainFrame(); 148 blink::WebFrame* frame = test_runner_->mainFrame();
149 if (!frame || frame->IsWebRemoteFrame()) 149 if (!frame || frame->IsWebRemoteFrame())
150 return; 150 return;
151 blink::WebLocalFrame* local_frame = frame->ToWebLocalFrame();
151 152
152 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); 153 v8::Local<v8::Context> context = local_frame->MainWorldScriptContext();
153 if (context.IsEmpty()) 154 if (context.IsEmpty())
154 return; 155 return;
155 156
156 v8::Context::Scope context_scope(context); 157 v8::Context::Scope context_scope(context);
157 158
158 frame->CallFunctionEvenIfScriptDisabled( 159 local_frame->CallFunctionEvenIfScriptDisabled(
159 v8::Local<v8::Function>::New(isolate, resolved_callback_), 160 v8::Local<v8::Function>::New(isolate, resolved_callback_),
160 context->Global(), 0, nullptr); 161 context->Global(), 0, nullptr);
161 } 162 }
162 163
163 } // namespace test_runner 164 } // namespace test_runner
OLDNEW
« no previous file with comments | « content/shell/test_runner/gc_controller.cc ('k') | content/shell/test_runner/test_interfaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698