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/ui/startup/bad_flags_prompt.h" | 5 #include "chrome/browser/ui/startup/bad_flags_prompt.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 11 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/simple_message_box.h" | 13 #include "chrome/browser/ui/simple_message_box.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/switch_utils.h" | 17 #include "chrome/common/switch_utils.h" |
18 #include "components/startup_metric_utils/startup_metric_utils.h" | 18 #include "components/startup_metric_utils/startup_metric_utils.h" |
19 #include "components/translate/core/common/translate_switches.h" | 19 #include "components/translate/core/common/translate_switches.h" |
| 20 #include "content/public/common/content_switches.h" |
20 #include "extensions/common/switches.h" | 21 #include "extensions/common/switches.h" |
| 22 #include "google_apis/gaia/gaia_switches.h" |
21 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
22 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
25 | 27 |
26 namespace chrome { | 28 namespace chrome { |
27 | 29 |
28 void ShowBadFlagsPrompt(Browser* browser) { | 30 void ShowBadFlagsPrompt(Browser* browser) { |
29 content::WebContents* web_contents = | 31 content::WebContents* web_contents = |
30 browser->tab_strip_model()->GetActiveWebContents(); | 32 browser->tab_strip_model()->GetActiveWebContents(); |
31 if (!web_contents) | 33 if (!web_contents) |
32 return; | 34 return; |
33 | 35 |
34 // Unsupported flags for which to display a warning that "stability and | 36 // Unsupported flags for which to display a warning that "stability and |
35 // security will suffer". | 37 // security will suffer". |
36 static const char* kBadFlags[] = { | 38 static const char* kBadFlags[] = { |
37 // These imply disabling the sandbox. | 39 // These flags disable sandbox-related security. |
| 40 switches::kDisableGpuSandbox, |
| 41 switches::kDisableSeccompFilterSandbox, |
| 42 switches::kDisableSetuidSandbox, |
| 43 switches::kDisableWebSecurity, |
| 44 switches::kNoSandbox, |
38 switches::kSingleProcess, | 45 switches::kSingleProcess, |
39 switches::kNoSandbox, | 46 |
40 switches::kDisableWebSecurity, | 47 // These flags disable or undermine the Same Origin Policy. |
41 // Browser plugin is dangerous on regular pages because it breaks the Same | |
42 // Origin Policy. | |
43 switches::kEnableBrowserPluginForAllViewTypes, | 48 switches::kEnableBrowserPluginForAllViewTypes, |
44 extensions::switches::kExtensionsOnChromeURLs, | 49 switches::kTrustedSpdyProxy, |
45 // This parameter should be used only for server side developments. | |
46 translate::switches::kTranslateScriptURL, | |
47 translate::switches::kTranslateSecurityOrigin, | 50 translate::switches::kTranslateSecurityOrigin, |
| 51 |
| 52 // These flags undermine HTTPS / connection security. |
| 53 switches::kDisableUserMediaSecurity, |
48 #if defined(ENABLE_WEBRTC) | 54 #if defined(ENABLE_WEBRTC) |
49 // This flag disables security of media packets in WebRTC. | |
50 switches::kDisableWebRtcEncryption, | 55 switches::kDisableWebRtcEncryption, |
51 #endif | 56 #endif |
| 57 switches::kIgnoreCertificateErrors, |
| 58 switches::kReduceSecurityForTesting, |
| 59 switches::kSyncAllowInsecureXmppConnection, |
| 60 |
| 61 // These flags change the URLs that handle PII. |
| 62 autofill::switches::kWalletSecureServiceUrl, |
| 63 switches::kGaiaUrl, |
| 64 translate::switches::kTranslateScriptURL, |
| 65 |
| 66 // This flag gives extensions more powers. |
| 67 extensions::switches::kExtensionsOnChromeURLs, |
52 NULL | 68 NULL |
53 }; | 69 }; |
54 | 70 |
55 for (const char** flag = kBadFlags; *flag; ++flag) { | 71 for (const char** flag = kBadFlags; *flag; ++flag) { |
56 if (CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { | 72 if (CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { |
57 SimpleAlertInfoBarDelegate::Create( | 73 SimpleAlertInfoBarDelegate::Create( |
58 InfoBarService::FromWebContents(web_contents), | 74 InfoBarService::FromWebContents(web_contents), |
59 InfoBarDelegate::kNoIconID, | 75 InfoBarDelegate::kNoIconID, |
60 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, | 76 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, |
61 base::UTF8ToUTF16( | 77 base::UTF8ToUTF16( |
(...skipping 29 matching lines...) Expand all Loading... |
91 user_data_dir.LossyDisplayName()); | 107 user_data_dir.LossyDisplayName()); |
92 | 108 |
93 if (cleanup_resource_bundle) | 109 if (cleanup_resource_bundle) |
94 ResourceBundle::CleanupSharedInstance(); | 110 ResourceBundle::CleanupSharedInstance(); |
95 | 111 |
96 // More complex dialogs cannot be shown before the earliest calls here. | 112 // More complex dialogs cannot be shown before the earliest calls here. |
97 ShowMessageBox(NULL, title, message, chrome::MESSAGE_BOX_TYPE_WARNING); | 113 ShowMessageBox(NULL, title, message, chrome::MESSAGE_BOX_TYPE_WARNING); |
98 } | 114 } |
99 | 115 |
100 } // namespace chrome | 116 } // namespace chrome |
OLD | NEW |