OLD | NEW |
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 Loading... |
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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 // properly cleanup. | 881 // properly cleanup. |
881 if (deleting_soon_) | 882 if (deleting_soon_) |
882 return; | 883 return; |
883 | 884 |
884 if (child_process_launcher_.get()) | 885 if (child_process_launcher_.get()) |
885 child_process_launcher_->SetProcessBackgrounded(backgrounded_); | 886 child_process_launcher_->SetProcessBackgrounded(backgrounded_); |
886 | 887 |
887 if (max_page_id_ != -1) | 888 if (max_page_id_ != -1) |
888 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); | 889 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); |
889 | 890 |
| 891 // WebKit's network state (window.navigator.onLine) defaults to true, |
| 892 // so if we're offline we need to notify the renderer at startup. |
| 893 if (net::NetworkChangeNotifier::IsOffline()) |
| 894 Send(new ViewMsg_NetworkStateChanged(false)); |
| 895 |
890 // NOTE: This needs to be before sending queued messages because | 896 // NOTE: This needs to be before sending queued messages because |
891 // ExtensionService uses this notification to initialize the renderer process | 897 // ExtensionService uses this notification to initialize the renderer process |
892 // with state that must be there before any JavaScript executes. | 898 // with state that must be there before any JavaScript executes. |
893 // | 899 // |
894 // The queued messages contain such things as "navigate". If this notification | 900 // The queued messages contain such things as "navigate". If this notification |
895 // was after, we can end up executing JavaScript before the initialization | 901 // was after, we can end up executing JavaScript before the initialization |
896 // happens. | 902 // happens. |
897 NotificationService::current()->Notify( | 903 NotificationService::current()->Notify( |
898 NotificationType::RENDERER_PROCESS_CREATED, | 904 NotificationType::RENDERER_PROCESS_CREATED, |
899 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 905 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
900 | 906 |
901 while (!queued_messages_.empty()) { | 907 while (!queued_messages_.empty()) { |
902 Send(queued_messages_.front()); | 908 Send(queued_messages_.front()); |
903 queued_messages_.pop(); | 909 queued_messages_.pop(); |
904 } | 910 } |
905 } | 911 } |
906 | 912 |
907 void BrowserRenderProcessHost::OnUserMetricsRecordAction( | 913 void BrowserRenderProcessHost::OnUserMetricsRecordAction( |
908 const std::string& action) { | 914 const std::string& action) { |
909 UserMetrics::RecordComputedAction(action); | 915 UserMetrics::RecordComputedAction(action); |
910 } | 916 } |
911 | 917 |
912 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 918 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
913 // Only honor the request if appropriate persmissions are granted. | 919 // Only honor the request if appropriate persmissions are granted. |
914 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 920 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
915 content::GetContentClient()->browser()->RevealFolderInOS(path); | 921 content::GetContentClient()->browser()->RevealFolderInOS(path); |
916 } | 922 } |
OLD | NEW |