Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 switches::kEnableDatabases, | 351 switches::kEnableDatabases, |
| 352 }; | 352 }; |
| 353 | 353 |
| 354 for (size_t i = 0; i < arraysize(switch_names); ++i) { | 354 for (size_t i = 0; i < arraysize(switch_names); ++i) { |
| 355 if (browser_command_line.HasSwitch(switch_names[i])) { | 355 if (browser_command_line.HasSwitch(switch_names[i])) { |
| 356 cmd_line.AppendSwitchWithValue(switch_names[i], | 356 cmd_line.AppendSwitchWithValue(switch_names[i], |
| 357 browser_command_line.GetSwitchValue(switch_names[i])); | 357 browser_command_line.GetSwitchValue(switch_names[i])); |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Tell the renderer to enable extensions if there are any extensions loaded. | |
|
Erik does not do reviews
2009/08/28 23:38:55
do we need to explicitly pass along extensions-dis
| |
| 362 // | |
| 363 // NOTE: This is subtly different than just passing along whether | |
| 364 // --enable-extenisons is present in the browser process. For example, there | |
| 365 // is also an extensions.enabled preference, and there may be various special | |
| 366 // cases about whether to allow extensions to load. | |
| 367 // | |
| 368 // This introduces a race condition where the first renderer never gets | |
| 369 // extensions enabled, so we also set the flag if extensions_enabled(). This | |
| 370 // isn't perfect though, because of the special cases above. | |
| 371 // | |
| 372 // TODO(aa): We need to get rid of the need to pass this flag at all. It is | |
| 373 // only used in one place in the renderer. | |
| 374 if (profile()->GetExtensionsService()) { | |
| 375 if (profile()->GetExtensionsService()->extensions()->size() > 0 || | |
| 376 profile()->GetExtensionsService()->extensions_enabled()) | |
| 377 cmd_line.AppendSwitch(switches::kEnableExtensions); | |
| 378 } | |
| 379 | |
| 380 // Pass on the browser locale. | 361 // Pass on the browser locale. |
| 381 const std::string locale = g_browser_process->GetApplicationLocale(); | 362 const std::string locale = g_browser_process->GetApplicationLocale(); |
| 382 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); | 363 cmd_line.AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); |
| 383 | 364 |
| 384 // If we run FieldTrials, we want to pass to their state to the renderer so | 365 // If we run FieldTrials, we want to pass to their state to the renderer so |
| 385 // that it can act in accordance with each state, or record histograms | 366 // that it can act in accordance with each state, or record histograms |
| 386 // relating to the FieldTrial states. | 367 // relating to the FieldTrial states. |
| 387 std::string field_trial_states; | 368 std::string field_trial_states; |
| 388 FieldTrialList::StatesToString(&field_trial_states); | 369 FieldTrialList::StatesToString(&field_trial_states); |
| 389 if (!field_trial_states.empty()) | 370 if (!field_trial_states.empty()) |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 991 profile()->GetExtensionMessageService()->RemoveEventListener(event_name, | 972 profile()->GetExtensionMessageService()->RemoveEventListener(event_name, |
| 992 pid()); | 973 pid()); |
| 993 } | 974 } |
| 994 } | 975 } |
| 995 | 976 |
| 996 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { | 977 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 997 if (profile()->GetExtensionMessageService()) { | 978 if (profile()->GetExtensionMessageService()) { |
| 998 profile()->GetExtensionMessageService()->CloseChannel(port_id); | 979 profile()->GetExtensionMessageService()->CloseChannel(port_id); |
| 999 } | 980 } |
| 1000 } | 981 } |
| OLD | NEW |