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

Side by Side Diff: content/browser/renderer_host/browser_render_process_host.cc

Issue 7259004: Convert ViewMsg_NetworkStateChanged from routed -> control, allowing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create a very simple observer, use it in BrowserProcess Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/browser_render_process_host.h" 8 #include "content/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "content/common/process_watcher.h" 71 #include "content/common/process_watcher.h"
72 #include "content/common/resource_messages.h" 72 #include "content/common/resource_messages.h"
73 #include "content/common/result_codes.h" 73 #include "content/common/result_codes.h"
74 #include "content/common/view_messages.h" 74 #include "content/common/view_messages.h"
75 #include "content/renderer/render_process_impl.h" 75 #include "content/renderer/render_process_impl.h"
76 #include "content/renderer/render_thread.h" 76 #include "content/renderer/render_thread.h"
77 #include "ipc/ipc_logging.h" 77 #include "ipc/ipc_logging.h"
78 #include "ipc/ipc_platform_file.h" 78 #include "ipc/ipc_platform_file.h"
79 #include "ipc/ipc_switches.h" 79 #include "ipc/ipc_switches.h"
80 #include "media/base/media_switches.h" 80 #include "media/base/media_switches.h"
81 #include "net/base/network_change_notifier.h"
81 #include "net/url_request/url_request_context_getter.h" 82 #include "net/url_request/url_request_context_getter.h"
82 #include "ui/base/ui_base_switches.h" 83 #include "ui/base/ui_base_switches.h"
83 #include "ui/gfx/gl/gl_switches.h" 84 #include "ui/gfx/gl/gl_switches.h"
84 #include "webkit/fileapi/file_system_path_manager.h" 85 #include "webkit/fileapi/file_system_path_manager.h"
85 #include "webkit/fileapi/sandbox_mount_point_provider.h" 86 #include "webkit/fileapi/sandbox_mount_point_provider.h"
86 #include "webkit/glue/resource_type.h" 87 #include "webkit/glue/resource_type.h"
87 #include "webkit/plugins/plugin_switches.h" 88 #include "webkit/plugins/plugin_switches.h"
88 89
89 #if defined(OS_WIN) 90 #if defined(OS_WIN)
90 #include <objbase.h> 91 #include <objbase.h>
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 // properly cleanup. 891 // properly cleanup.
891 if (deleting_soon_) 892 if (deleting_soon_)
892 return; 893 return;
893 894
894 if (child_process_launcher_.get()) 895 if (child_process_launcher_.get())
895 child_process_launcher_->SetProcessBackgrounded(backgrounded_); 896 child_process_launcher_->SetProcessBackgrounded(backgrounded_);
896 897
897 if (max_page_id_ != -1) 898 if (max_page_id_ != -1)
898 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); 899 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1));
899 900
901 // WebKit's network state (window.navigator.onLine) defaults to true,
902 // so if we're offline we need to notify the renderer at startup.
903 if (net::NetworkChangeNotifier::IsOffline())
904 Send(new ViewMsg_NetworkStateChanged(false));
905
900 // NOTE: This needs to be before sending queued messages because 906 // NOTE: This needs to be before sending queued messages because
901 // ExtensionService uses this notification to initialize the renderer process 907 // ExtensionService uses this notification to initialize the renderer process
902 // with state that must be there before any JavaScript executes. 908 // with state that must be there before any JavaScript executes.
903 // 909 //
904 // The queued messages contain such things as "navigate". If this notification 910 // The queued messages contain such things as "navigate". If this notification
905 // was after, we can end up executing JavaScript before the initialization 911 // was after, we can end up executing JavaScript before the initialization
906 // happens. 912 // happens.
907 NotificationService::current()->Notify( 913 NotificationService::current()->Notify(
908 NotificationType::RENDERER_PROCESS_CREATED, 914 NotificationType::RENDERER_PROCESS_CREATED,
909 Source<RenderProcessHost>(this), NotificationService::NoDetails()); 915 Source<RenderProcessHost>(this), NotificationService::NoDetails());
910 916
911 while (!queued_messages_.empty()) { 917 while (!queued_messages_.empty()) {
912 Send(queued_messages_.front()); 918 Send(queued_messages_.front());
913 queued_messages_.pop(); 919 queued_messages_.pop();
914 } 920 }
915 } 921 }
916 922
917 void BrowserRenderProcessHost::OnUserMetricsRecordAction( 923 void BrowserRenderProcessHost::OnUserMetricsRecordAction(
918 const std::string& action) { 924 const std::string& action) {
919 UserMetrics::RecordComputedAction(action); 925 UserMetrics::RecordComputedAction(action);
920 } 926 }
921 927
922 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { 928 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) {
923 // Only honor the request if appropriate persmissions are granted. 929 // Only honor the request if appropriate persmissions are granted.
924 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) 930 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path))
925 content::GetContentClient()->browser()->RevealFolderInOS(path); 931 content::GetContentClient()->browser()->RevealFolderInOS(path);
926 } 932 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698