OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_browser_main_win.h" | 5 #include "chrome/browser/chrome_browser_main_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "chrome/common/chrome_result_codes.h" | 35 #include "chrome/common/chrome_result_codes.h" |
36 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/env_vars.h" | 37 #include "chrome/common/env_vars.h" |
38 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 38 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
39 #include "chrome/installer/util/browser_distribution.h" | 39 #include "chrome/installer/util/browser_distribution.h" |
40 #include "chrome/installer/util/helper.h" | 40 #include "chrome/installer/util/helper.h" |
41 #include "chrome/installer/util/install_util.h" | 41 #include "chrome/installer/util/install_util.h" |
42 #include "chrome/installer/util/l10n_string_util.h" | 42 #include "chrome/installer/util/l10n_string_util.h" |
43 #include "chrome/installer/util/shell_util.h" | 43 #include "chrome/installer/util/shell_util.h" |
44 #include "content/public/common/main_function_params.h" | 44 #include "content/public/common/main_function_params.h" |
45 #include "content/public/common/sandbox_init.h" | |
45 #include "grit/app_locale_settings.h" | 46 #include "grit/app_locale_settings.h" |
46 #include "grit/chromium_strings.h" | 47 #include "grit/chromium_strings.h" |
47 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
48 #include "installer_util_strings/installer_util_strings.h" | 49 #include "installer_util_strings/installer_util_strings.h" |
50 #include "sandbox/win/src/sandbox_policy.h" | |
49 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
50 #include "ui/base/l10n/l10n_util_win.h" | 52 #include "ui/base/l10n/l10n_util_win.h" |
51 #include "ui/base/ui_base_switches.h" | 53 #include "ui/base/ui_base_switches.h" |
52 #include "ui/base/win/message_box_win.h" | 54 #include "ui/base/win/message_box_win.h" |
53 #include "ui/gfx/platform_font_win.h" | 55 #include "ui/gfx/platform_font_win.h" |
54 | 56 |
55 namespace { | 57 namespace { |
56 | 58 |
57 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( | 59 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)( |
58 const wchar_t* command_line, | 60 const wchar_t* command_line, |
(...skipping 19 matching lines...) Expand all Loading... | |
78 int min_font_size; | 80 int min_font_size; |
79 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), | 81 base::StringToInt(l10n_util::GetStringUTF16(IDS_MINIMUM_UI_FONT_SIZE), |
80 &min_font_size); | 82 &min_font_size); |
81 return min_font_size; | 83 return min_font_size; |
82 } | 84 } |
83 | 85 |
84 class TranslationDelegate : public installer::TranslationDelegate { | 86 class TranslationDelegate : public installer::TranslationDelegate { |
85 public: | 87 public: |
86 virtual string16 GetLocalizedString(int installer_string_id) OVERRIDE; | 88 virtual string16 GetLocalizedString(int installer_string_id) OVERRIDE; |
87 }; | 89 }; |
88 | 90 |
cpu_(ooo_6.6-7.5)
2013/03/18 19:46:26
this function looks really ugly here, isn't a bett
jam
2013/03/18 19:50:19
I agree this is a bit of an odd function. I think
| |
91 void AddNaClPolicyCallback(CommandLine* cmd_line, | |
92 sandbox::TargetPolicy* policy) { | |
93 if (cmd_line->GetSwitchValueASCII(switches::kProcessType) != | |
94 switches::kRendererProcess) { | |
95 return; | |
96 } | |
97 | |
98 // This code is duplicated in nacl_exe_win_64.cc. | |
99 // Allow the server side of a pipe restricted to the "chrome.nacl." | |
100 // namespace so that it cannot impersonate other system or other chrome | |
101 // service pipes. | |
102 sandbox::ResultCode result = policy->AddRule( | |
103 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, | |
104 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, | |
105 L"\\\\.\\pipe\\chrome.nacl.*"); | |
106 CHECK(result == sandbox::SBOX_ALL_OK); | |
107 | |
108 // Renderers need to send named pipe handles and shared memory | |
109 // segment handles to NaCl loader processes. | |
110 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, | |
111 sandbox::TargetPolicy::HANDLES_DUP_ANY, | |
112 L"File"); | |
113 CHECK(result == sandbox::SBOX_ALL_OK); | |
114 } | |
115 | |
89 } // namespace | 116 } // namespace |
90 | 117 |
91 void RecordBreakpadStatusUMA(MetricsService* metrics) { | 118 void RecordBreakpadStatusUMA(MetricsService* metrics) { |
92 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); | 119 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); |
93 } | 120 } |
94 | 121 |
95 void WarnAboutMinimumSystemRequirements() { | 122 void WarnAboutMinimumSystemRequirements() { |
96 if (base::win::GetVersion() < base::win::VERSION_XP) { | 123 if (base::win::GetVersion() < base::win::VERSION_XP) { |
97 chrome::ShowMessageBox(NULL, | 124 chrome::ShowMessageBox(NULL, |
98 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 125 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 if (base::win::IsTSFAwareRequired()) { | 235 if (base::win::IsTSFAwareRequired()) { |
209 // Create a TSF message filter for the message loop. MessageLoop takes | 236 // Create a TSF message filter for the message loop. MessageLoop takes |
210 // ownership of the filter. | 237 // ownership of the filter. |
211 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( | 238 scoped_ptr<base::win::TextServicesMessageFilter> tsf_message_filter( |
212 new base::win::TextServicesMessageFilter); | 239 new base::win::TextServicesMessageFilter); |
213 if (tsf_message_filter->Init()) { | 240 if (tsf_message_filter->Init()) { |
214 MessageLoopForUI::current()->SetMessageFilter( | 241 MessageLoopForUI::current()->SetMessageFilter( |
215 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); | 242 tsf_message_filter.PassAs<MessageLoopForUI::MessageFilter>()); |
216 } | 243 } |
217 } | 244 } |
245 | |
246 content::SetSandboxedProcessStartingCallback( | |
247 base::Bind(AddNaClPolicyCallback)); | |
218 } | 248 } |
219 | 249 |
220 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { | 250 void ChromeBrowserMainPartsWin::PreMainMessageLoopRun() { |
221 ChromeBrowserMainParts::PreMainMessageLoopRun(); | 251 ChromeBrowserMainParts::PreMainMessageLoopRun(); |
222 | 252 |
223 storage_monitor_->Init(); | 253 storage_monitor_->Init(); |
224 } | 254 } |
225 | 255 |
226 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { | 256 void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
227 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), | 257 ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 if (resource_id) | 428 if (resource_id) |
399 return l10n_util::GetStringUTF16(resource_id); | 429 return l10n_util::GetStringUTF16(resource_id); |
400 return string16(); | 430 return string16(); |
401 } | 431 } |
402 | 432 |
403 // static | 433 // static |
404 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 434 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
405 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 435 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
406 installer::SetTranslationDelegate(&delegate); | 436 installer::SetTranslationDelegate(&delegate); |
407 } | 437 } |
OLD | NEW |