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