| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 10 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "components/translate/common/translate_switches.h" |
| 14 #include "extensions/common/switches.h" | 15 #include "extensions/common/switches.h" |
| 15 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 | 18 |
| 18 namespace chrome { | 19 namespace chrome { |
| 19 | 20 |
| 20 void ShowBadFlagsPrompt(Browser* browser) { | 21 void ShowBadFlagsPrompt(Browser* browser) { |
| 21 content::WebContents* web_contents = | 22 content::WebContents* web_contents = |
| 22 browser->tab_strip_model()->GetActiveWebContents(); | 23 browser->tab_strip_model()->GetActiveWebContents(); |
| 23 if (!web_contents) | 24 if (!web_contents) |
| 24 return; | 25 return; |
| 25 | 26 |
| 26 // Unsupported flags for which to display a warning that "stability and | 27 // Unsupported flags for which to display a warning that "stability and |
| 27 // security will suffer". | 28 // security will suffer". |
| 28 static const char* kBadFlags[] = { | 29 static const char* kBadFlags[] = { |
| 29 // These imply disabling the sandbox. | 30 // These imply disabling the sandbox. |
| 30 switches::kSingleProcess, | 31 switches::kSingleProcess, |
| 31 switches::kNoSandbox, | 32 switches::kNoSandbox, |
| 32 switches::kDisableWebSecurity, | 33 switches::kDisableWebSecurity, |
| 33 // Browser plugin is dangerous on regular pages because it breaks the Same | 34 // Browser plugin is dangerous on regular pages because it breaks the Same |
| 34 // Origin Policy. | 35 // Origin Policy. |
| 35 switches::kEnableBrowserPluginForAllViewTypes, | 36 switches::kEnableBrowserPluginForAllViewTypes, |
| 36 extensions::switches::kExtensionsOnChromeURLs, | 37 extensions::switches::kExtensionsOnChromeURLs, |
| 37 // This parameter should be used only for server side developments. | 38 // This parameter should be used only for server side developments. |
| 38 switches::kTranslateScriptURL, | 39 switches::kTranslateScriptURL, |
| 39 switches::kTranslateSecurityOrigin, | 40 translate::switches::kTranslateSecurityOrigin, |
| 40 NULL | 41 NULL |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 for (const char** flag = kBadFlags; *flag; ++flag) { | 44 for (const char** flag = kBadFlags; *flag; ++flag) { |
| 44 if (CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { | 45 if (CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { |
| 45 SimpleAlertInfoBarDelegate::Create( | 46 SimpleAlertInfoBarDelegate::Create( |
| 46 InfoBarService::FromWebContents(web_contents), | 47 InfoBarService::FromWebContents(web_contents), |
| 47 InfoBarDelegate::kNoIconID, | 48 InfoBarDelegate::kNoIconID, |
| 48 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, | 49 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, |
| 49 UTF8ToUTF16(std::string("--") + *flag)), | 50 UTF8ToUTF16(std::string("--") + *flag)), |
| 50 false); | 51 false); |
| 51 return; | 52 return; |
| 52 } | 53 } |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace chrome | 57 } // namespace chrome |
| OLD | NEW |