OLD | NEW |
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 // 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 "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/common/logging_chrome.h" | 50 #include "chrome/common/logging_chrome.h" |
51 #include "chrome/common/notification_service.h" | 51 #include "chrome/common/notification_service.h" |
52 #include "chrome/common/process_watcher.h" | 52 #include "chrome/common/process_watcher.h" |
53 #include "chrome/common/render_messages.h" | 53 #include "chrome/common/render_messages.h" |
54 #include "chrome/common/result_codes.h" | 54 #include "chrome/common/result_codes.h" |
55 #include "chrome/renderer/render_process.h" | 55 #include "chrome/renderer/render_process.h" |
56 #include "chrome/renderer/render_thread.h" | 56 #include "chrome/renderer/render_thread.h" |
57 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
58 #include "ipc/ipc_logging.h" | 58 #include "ipc/ipc_logging.h" |
59 #include "ipc/ipc_message.h" | 59 #include "ipc/ipc_message.h" |
| 60 #include "ipc/ipc_platform_file.h" |
60 #include "ipc/ipc_switches.h" | 61 #include "ipc/ipc_switches.h" |
61 | 62 |
62 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
63 #include "app/win_util.h" | 64 #include "app/win_util.h" |
64 #include "chrome/browser/sandbox_policy.h" | 65 #include "chrome/browser/sandbox_policy.h" |
65 #elif defined(OS_LINUX) | 66 #elif defined(OS_LINUX) |
66 #include "base/singleton.h" | 67 #include "base/singleton.h" |
67 #include "chrome/browser/crash_handler_host_linux.h" | 68 #include "chrome/browser/crash_handler_host_linux.h" |
68 #include "chrome/browser/zygote_host_linux.h" | 69 #include "chrome/browser/zygote_host_linux.h" |
69 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" | 70 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 } | 1119 } |
1119 | 1120 |
1120 void BrowserRenderProcessHost::AddSpellCheckWord(const std::string& word) { | 1121 void BrowserRenderProcessHost::AddSpellCheckWord(const std::string& word) { |
1121 Send(new ViewMsg_SpellChecker_WordAdded(word)); | 1122 Send(new ViewMsg_SpellChecker_WordAdded(word)); |
1122 } | 1123 } |
1123 | 1124 |
1124 void BrowserRenderProcessHost::InitSpellChecker() { | 1125 void BrowserRenderProcessHost::InitSpellChecker() { |
1125 SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost(); | 1126 SpellCheckHost* spellcheck_host = profile()->GetSpellCheckHost(); |
1126 if (spellcheck_host) { | 1127 if (spellcheck_host) { |
1127 PrefService* prefs = profile()->GetPrefs(); | 1128 PrefService* prefs = profile()->GetPrefs(); |
| 1129 IPC::PlatformFileForTransit file; |
| 1130 #if defined(OS_POSIX) |
| 1131 file = base::FileDescriptor(spellcheck_host->bdict_file(), false); |
| 1132 #elif defined(OS_WIN) |
| 1133 ::DuplicateHandle(::GetCurrentProcess(), spellcheck_host->bdict_file(), |
| 1134 process().handle(), &file, |
| 1135 0, false, DUPLICATE_SAME_ACCESS); |
| 1136 #endif |
1128 Send(new ViewMsg_SpellChecker_Init( | 1137 Send(new ViewMsg_SpellChecker_Init( |
1129 spellcheck_host->bdict_fd(), spellcheck_host->custom_words(), | 1138 file, |
| 1139 spellcheck_host->custom_words(), |
1130 spellcheck_host->language(), | 1140 spellcheck_host->language(), |
1131 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); | 1141 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); |
1132 } else { | 1142 } else { |
1133 Send(new ViewMsg_SpellChecker_Init( | 1143 Send(new ViewMsg_SpellChecker_Init( |
1134 base::FileDescriptor(), std::vector<std::string>(), std::string(), | 1144 IPC::PlatformFileForTransit(), |
| 1145 std::vector<std::string>(), |
| 1146 std::string(), |
1135 false)); | 1147 false)); |
1136 } | 1148 } |
1137 } | 1149 } |
1138 | 1150 |
1139 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { | 1151 void BrowserRenderProcessHost::EnableAutoSpellCorrect(bool enable) { |
1140 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); | 1152 Send(new ViewMsg_SpellChecker_EnableAutoSpellCorrect(enable)); |
1141 } | 1153 } |
1142 #endif | 1154 #endif |
OLD | NEW |