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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 194079: renderer process notifications support (Closed)
Patch Set: last change for code review Created 11 years, 2 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 #include "chrome/renderer/audio_message_filter.h" 38 #include "chrome/renderer/audio_message_filter.h"
39 #include "chrome/renderer/devtools_agent.h" 39 #include "chrome/renderer/devtools_agent.h"
40 #include "chrome/renderer/devtools_client.h" 40 #include "chrome/renderer/devtools_client.h"
41 #include "chrome/renderer/extension_groups.h" 41 #include "chrome/renderer/extension_groups.h"
42 #include "chrome/renderer/extensions/event_bindings.h" 42 #include "chrome/renderer/extensions/event_bindings.h"
43 #include "chrome/renderer/extensions/extension_process_bindings.h" 43 #include "chrome/renderer/extensions/extension_process_bindings.h"
44 #include "chrome/renderer/extensions/renderer_extension_bindings.h" 44 #include "chrome/renderer/extensions/renderer_extension_bindings.h"
45 #include "chrome/renderer/localized_error.h" 45 #include "chrome/renderer/localized_error.h"
46 #include "chrome/renderer/media/audio_renderer_impl.h" 46 #include "chrome/renderer/media/audio_renderer_impl.h"
47 #include "chrome/renderer/navigation_state.h" 47 #include "chrome/renderer/navigation_state.h"
48 #include "chrome/renderer/notification_provider.h"
48 #include "chrome/renderer/plugin_channel_host.h" 49 #include "chrome/renderer/plugin_channel_host.h"
49 #include "chrome/renderer/print_web_view_helper.h" 50 #include "chrome/renderer/print_web_view_helper.h"
50 #include "chrome/renderer/render_process.h" 51 #include "chrome/renderer/render_process.h"
51 #include "chrome/renderer/user_script_slave.h" 52 #include "chrome/renderer/user_script_slave.h"
52 #include "chrome/renderer/visitedlink_slave.h" 53 #include "chrome/renderer/visitedlink_slave.h"
53 #include "chrome/renderer/webplugin_delegate_proxy.h" 54 #include "chrome/renderer/webplugin_delegate_proxy.h"
54 #include "chrome/renderer/webworker_proxy.h" 55 #include "chrome/renderer/webworker_proxy.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
56 #include "grit/renderer_resources.h" 57 #include "grit/renderer_resources.h"
57 #include "net/base/data_url.h" 58 #include "net/base/data_url.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 delete *i; 246 delete *i;
246 } 247 }
247 248
248 #if defined(OS_MACOSX) 249 #if defined(OS_MACOSX)
249 // Tell the spellchecker that the document is closed. 250 // Tell the spellchecker that the document is closed.
250 if (has_document_tag_) 251 if (has_document_tag_)
251 Send(new ViewHostMsg_DocumentWithTagClosed(routing_id_, document_tag_)); 252 Send(new ViewHostMsg_DocumentWithTagClosed(routing_id_, document_tag_));
252 #endif 253 #endif
253 254
254 render_thread_->RemoveFilter(audio_message_filter_); 255 render_thread_->RemoveFilter(audio_message_filter_);
256 render_thread_->RemoveFilter(notification_provider_.get());
255 } 257 }
256 258
257 /*static*/ 259 /*static*/
258 RenderView* RenderView::Create( 260 RenderView* RenderView::Create(
259 RenderThreadBase* render_thread, 261 RenderThreadBase* render_thread,
260 gfx::NativeViewId parent_hwnd, 262 gfx::NativeViewId parent_hwnd,
261 int32 opener_id, 263 int32 opener_id,
262 const RendererPreferences& renderer_prefs, 264 const RendererPreferences& renderer_prefs,
263 const WebPreferences& webkit_prefs, 265 const WebPreferences& webkit_prefs,
264 SharedRenderViewCounter* counter, 266 SharedRenderViewCounter* counter,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 shared_popup_counter_ = counter; 307 shared_popup_counter_ = counter;
306 shared_popup_counter_->data++; 308 shared_popup_counter_->data++;
307 decrement_shared_popup_at_destruction_ = true; 309 decrement_shared_popup_at_destruction_ = true;
308 } else { 310 } else {
309 shared_popup_counter_ = new SharedRenderViewCounter(0); 311 shared_popup_counter_ = new SharedRenderViewCounter(0);
310 decrement_shared_popup_at_destruction_ = false; 312 decrement_shared_popup_at_destruction_ = false;
311 } 313 }
312 314
313 devtools_agent_.reset(new DevToolsAgent(routing_id, this)); 315 devtools_agent_.reset(new DevToolsAgent(routing_id, this));
314 316
317 notification_provider_ = new NotificationProvider(this);
318
315 webwidget_ = WebView::Create(this); 319 webwidget_ = WebView::Create(this);
316 webkit_preferences_.Apply(webview()); 320 webkit_preferences_.Apply(webview());
317 webview()->InitializeMainFrame(this); 321 webview()->InitializeMainFrame(this);
318 322
319 OnSetRendererPrefs(renderer_prefs); 323 OnSetRendererPrefs(renderer_prefs);
320 324
321 // Don't let WebCore keep a B/F list - we have our own. 325 // Don't let WebCore keep a B/F list - we have our own.
322 // We let it keep 1 entry because FrameLoader::goToItem expects an item in the 326 // We let it keep 1 entry because FrameLoader::goToItem expects an item in the
323 // backForwardList, which is used only in ASSERTs. 327 // backForwardList, which is used only in ASSERTs.
324 webview()->SetBackForwardListSize(1); 328 webview()->SetBackForwardListSize(1);
(...skipping 12 matching lines...) Expand all
337 } 341 }
338 342
339 host_window_ = parent_hwnd; 343 host_window_ = parent_hwnd;
340 344
341 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 345 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
342 if (command_line.HasSwitch(switches::kDomAutomationController)) 346 if (command_line.HasSwitch(switches::kDomAutomationController))
343 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION; 347 enabled_bindings_ |= BindingsPolicy::DOM_AUTOMATION;
344 348
345 audio_message_filter_ = new AudioMessageFilter(routing_id_); 349 audio_message_filter_ = new AudioMessageFilter(routing_id_);
346 render_thread_->AddFilter(audio_message_filter_); 350 render_thread_->AddFilter(audio_message_filter_);
351 render_thread_->AddFilter(notification_provider_.get());
347 } 352 }
348 353
349 void RenderView::OnMessageReceived(const IPC::Message& message) { 354 void RenderView::OnMessageReceived(const IPC::Message& message) {
350 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; 355 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
351 child_process_logging::ScopedActiveURLSetter url_setter( 356 child_process_logging::ScopedActiveURLSetter url_setter(
352 main_frame ? main_frame->url() : WebURL()); 357 main_frame ? main_frame->url() : WebURL());
353 358
354 // If this is developer tools renderer intercept tools messages first. 359 // If this is developer tools renderer intercept tools messages first.
355 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) 360 if (devtools_client_.get() && devtools_client_->OnMessageReceived(message))
356 return; 361 return;
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after
3615 new PluginMsg_SignalModalDialogEvent(host_window_)); 3620 new PluginMsg_SignalModalDialogEvent(host_window_));
3616 3621
3617 message->EnableMessagePumping(); // Runs a nested message loop. 3622 message->EnableMessagePumping(); // Runs a nested message loop.
3618 bool rv = Send(message); 3623 bool rv = Send(message);
3619 3624
3620 PluginChannelHost::Broadcast( 3625 PluginChannelHost::Broadcast(
3621 new PluginMsg_ResetModalDialogEvent(host_window_)); 3626 new PluginMsg_ResetModalDialogEvent(host_window_));
3622 3627
3623 return rv; 3628 return rv;
3624 } 3629 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698