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" | |
82 #include "net/url_request/url_request_context_getter.h" | 81 #include "net/url_request/url_request_context_getter.h" |
83 #include "ui/base/ui_base_switches.h" | 82 #include "ui/base/ui_base_switches.h" |
84 #include "ui/gfx/gl/gl_switches.h" | 83 #include "ui/gfx/gl/gl_switches.h" |
85 #include "webkit/fileapi/file_system_path_manager.h" | 84 #include "webkit/fileapi/file_system_path_manager.h" |
86 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 85 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
87 #include "webkit/glue/resource_type.h" | 86 #include "webkit/glue/resource_type.h" |
88 #include "webkit/plugins/plugin_switches.h" | 87 #include "webkit/plugins/plugin_switches.h" |
89 | 88 |
90 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
91 #include <objbase.h> | 90 #include <objbase.h> |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 // properly cleanup. | 880 // properly cleanup. |
882 if (deleting_soon_) | 881 if (deleting_soon_) |
883 return; | 882 return; |
884 | 883 |
885 if (child_process_launcher_.get()) | 884 if (child_process_launcher_.get()) |
886 child_process_launcher_->SetProcessBackgrounded(backgrounded_); | 885 child_process_launcher_->SetProcessBackgrounded(backgrounded_); |
887 | 886 |
888 if (max_page_id_ != -1) | 887 if (max_page_id_ != -1) |
889 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); | 888 Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); |
890 | 889 |
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 | |
896 // NOTE: This needs to be before sending queued messages because | 890 // NOTE: This needs to be before sending queued messages because |
897 // ExtensionService uses this notification to initialize the renderer process | 891 // ExtensionService uses this notification to initialize the renderer process |
898 // with state that must be there before any JavaScript executes. | 892 // with state that must be there before any JavaScript executes. |
899 // | 893 // |
900 // The queued messages contain such things as "navigate". If this notification | 894 // The queued messages contain such things as "navigate". If this notification |
901 // was after, we can end up executing JavaScript before the initialization | 895 // was after, we can end up executing JavaScript before the initialization |
902 // happens. | 896 // happens. |
903 NotificationService::current()->Notify( | 897 NotificationService::current()->Notify( |
904 NotificationType::RENDERER_PROCESS_CREATED, | 898 NotificationType::RENDERER_PROCESS_CREATED, |
905 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 899 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
906 | 900 |
907 while (!queued_messages_.empty()) { | 901 while (!queued_messages_.empty()) { |
908 Send(queued_messages_.front()); | 902 Send(queued_messages_.front()); |
909 queued_messages_.pop(); | 903 queued_messages_.pop(); |
910 } | 904 } |
911 } | 905 } |
912 | 906 |
913 void BrowserRenderProcessHost::OnUserMetricsRecordAction( | 907 void BrowserRenderProcessHost::OnUserMetricsRecordAction( |
914 const std::string& action) { | 908 const std::string& action) { |
915 UserMetrics::RecordComputedAction(action); | 909 UserMetrics::RecordComputedAction(action); |
916 } | 910 } |
917 | 911 |
918 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { | 912 void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) { |
919 // Only honor the request if appropriate persmissions are granted. | 913 // Only honor the request if appropriate persmissions are granted. |
920 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) | 914 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(id(), path)) |
921 content::GetContentClient()->browser()->RevealFolderInOS(path); | 915 content::GetContentClient()->browser()->RevealFolderInOS(path); |
922 } | 916 } |
OLD | NEW |