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

Side by Side Diff: chrome/renderer/extensions/extension_helper.cc

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/extension_helper.h" 5 #include "chrome/renderer/extensions/extension_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 17 matching lines...) Expand all
28 #include "content/public/renderer/render_view_visitor.h" 28 #include "content/public/renderer/render_view_visitor.h"
29 #include "extensions/common/constants.h" 29 #include "extensions/common/constants.h"
30 #include "third_party/WebKit/public/platform/WebURLRequest.h" 30 #include "third_party/WebKit/public/platform/WebURLRequest.h"
31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 31 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
32 #include "third_party/WebKit/public/web/WebDocument.h" 32 #include "third_party/WebKit/public/web/WebDocument.h"
33 #include "third_party/WebKit/public/web/WebFrame.h" 33 #include "third_party/WebKit/public/web/WebFrame.h"
34 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 34 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
35 #include "third_party/WebKit/public/web/WebView.h" 35 #include "third_party/WebKit/public/web/WebView.h"
36 36
37 using content::ConsoleMessageLevel; 37 using content::ConsoleMessageLevel;
38 using WebKit::WebConsoleMessage; 38 using blink::WebConsoleMessage;
39 using WebKit::WebDataSource; 39 using blink::WebDataSource;
40 using WebKit::WebFrame; 40 using blink::WebFrame;
41 using WebKit::WebURLRequest; 41 using blink::WebURLRequest;
42 using WebKit::WebScopedUserGesture; 42 using blink::WebScopedUserGesture;
43 using WebKit::WebView; 43 using blink::WebView;
44 44
45 namespace extensions { 45 namespace extensions {
46 46
47 namespace { 47 namespace {
48 // Keeps a mapping from the frame pointer to a UserScriptScheduler object. 48 // Keeps a mapping from the frame pointer to a UserScriptScheduler object.
49 // We store this mapping per process, because a frame can jump from one 49 // We store this mapping per process, because a frame can jump from one
50 // document to another with adoptNode, and so having the object be a 50 // document to another with adoptNode, and so having the object be a
51 // RenderViewObserver means it might miss some notifications after it moves. 51 // RenderViewObserver means it might miss some notifications after it moves.
52 typedef std::map<WebFrame*, UserScriptScheduler*> SchedulerMap; 52 typedef std::map<WebFrame*, UserScriptScheduler*> SchedulerMap;
53 static base::LazyInstance<SchedulerMap> g_schedulers = 53 static base::LazyInstance<SchedulerMap> g_schedulers =
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) { 180 void ExtensionHelper::DidFinishDocumentLoad(WebFrame* frame) {
181 dispatcher_->user_script_slave()->InjectScripts( 181 dispatcher_->user_script_slave()->InjectScripts(
182 frame, UserScript::DOCUMENT_END); 182 frame, UserScript::DOCUMENT_END);
183 183
184 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 184 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
185 if (i != g_schedulers.Get().end()) 185 if (i != g_schedulers.Get().end())
186 i->second->DidFinishDocumentLoad(); 186 i->second->DidFinishDocumentLoad();
187 } 187 }
188 188
189 void ExtensionHelper::DidFinishLoad(WebKit::WebFrame* frame) { 189 void ExtensionHelper::DidFinishLoad(blink::WebFrame* frame) {
190 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 190 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
191 if (i != g_schedulers.Get().end()) 191 if (i != g_schedulers.Get().end())
192 i->second->DidFinishLoad(); 192 i->second->DidFinishLoad();
193 } 193 }
194 194
195 void ExtensionHelper::DidCreateDocumentElement(WebFrame* frame) { 195 void ExtensionHelper::DidCreateDocumentElement(WebFrame* frame) {
196 dispatcher_->user_script_slave()->InjectScripts( 196 dispatcher_->user_script_slave()->InjectScripts(
197 frame, UserScript::DOCUMENT_START); 197 frame, UserScript::DOCUMENT_START);
198 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 198 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
199 if (i != g_schedulers.Get().end()) 199 if (i != g_schedulers.Get().end())
200 i->second->DidCreateDocumentElement(); 200 i->second->DidCreateDocumentElement();
201 201
202 dispatcher_->DidCreateDocumentElement(frame); 202 dispatcher_->DidCreateDocumentElement(frame);
203 } 203 }
204 204
205 void ExtensionHelper::DidStartProvisionalLoad(WebKit::WebFrame* frame) { 205 void ExtensionHelper::DidStartProvisionalLoad(blink::WebFrame* frame) {
206 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 206 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
207 if (i != g_schedulers.Get().end()) 207 if (i != g_schedulers.Get().end())
208 i->second->DidStartProvisionalLoad(); 208 i->second->DidStartProvisionalLoad();
209 } 209 }
210 210
211 void ExtensionHelper::DraggableRegionsChanged(WebKit::WebFrame* frame) { 211 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) {
212 WebKit::WebVector<WebKit::WebDraggableRegion> webregions = 212 blink::WebVector<blink::WebDraggableRegion> webregions =
213 frame->document().draggableRegions(); 213 frame->document().draggableRegions();
214 std::vector<DraggableRegion> regions; 214 std::vector<DraggableRegion> regions;
215 for (size_t i = 0; i < webregions.size(); ++i) { 215 for (size_t i = 0; i < webregions.size(); ++i) {
216 DraggableRegion region; 216 DraggableRegion region;
217 region.bounds = webregions[i].bounds; 217 region.bounds = webregions[i].bounds;
218 region.draggable = webregions[i].draggable; 218 region.draggable = webregions[i].draggable;
219 regions.push_back(region); 219 regions.push_back(region);
220 } 220 }
221 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); 221 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions));
222 } 222 }
223 223
224 void ExtensionHelper::FrameDetached(WebFrame* frame) { 224 void ExtensionHelper::FrameDetached(WebFrame* frame) {
225 // This could be called before DidCreateDataSource, in which case the frame 225 // This could be called before DidCreateDataSource, in which case the frame
226 // won't be in the map. 226 // won't be in the map.
227 SchedulerMap::iterator i = g_schedulers.Get().find(frame); 227 SchedulerMap::iterator i = g_schedulers.Get().find(frame);
228 if (i == g_schedulers.Get().end()) 228 if (i == g_schedulers.Get().end())
229 return; 229 return;
230 230
231 delete i->second; 231 delete i->second;
232 g_schedulers.Get().erase(i); 232 g_schedulers.Get().erase(i);
233 } 233 }
234 234
235 void ExtensionHelper::DidMatchCSS( 235 void ExtensionHelper::DidMatchCSS(
236 WebKit::WebFrame* frame, 236 blink::WebFrame* frame,
237 const WebKit::WebVector<WebKit::WebString>& newly_matching_selectors, 237 const blink::WebVector<blink::WebString>& newly_matching_selectors,
238 const WebKit::WebVector<WebKit::WebString>& stopped_matching_selectors) { 238 const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
239 dispatcher_->DidMatchCSS( 239 dispatcher_->DidMatchCSS(
240 frame, newly_matching_selectors, stopped_matching_selectors); 240 frame, newly_matching_selectors, stopped_matching_selectors);
241 } 241 }
242 242
243 void ExtensionHelper::DidCreateDataSource(WebFrame* frame, WebDataSource* ds) { 243 void ExtensionHelper::DidCreateDataSource(WebFrame* frame, WebDataSource* ds) {
244 // Check first if we created a scheduler for the frame, since this function 244 // Check first if we created a scheduler for the frame, since this function
245 // gets called for navigations within the document. 245 // gets called for navigations within the document.
246 if (g_schedulers.Get().count(frame)) 246 if (g_schedulers.Get().count(frame))
247 return; 247 return;
248 248
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); 369 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext();
370 ChromeV8Context* chrome_v8_context = 370 ChromeV8Context* chrome_v8_context =
371 dispatcher_->v8_context_set().GetByV8Context(script_context); 371 dispatcher_->v8_context_set().GetByV8Context(script_context);
372 if (!chrome_v8_context) 372 if (!chrome_v8_context)
373 return; 373 return;
374 chrome_v8_context->module_system()->CallModuleMethod( 374 chrome_v8_context->module_system()->CallModuleMethod(
375 "app.window", "onAppWindowClosed"); 375 "app.window", "onAppWindowClosed");
376 } 376 }
377 377
378 } // namespace extensions 378 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_helper.h ('k') | chrome/renderer/extensions/feedback_private_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698