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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/startup/bad_flags_prompt.h"
7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h"
14 #include "components/translate/core/common/translate_switches.h"
15 #include "extensions/common/switches.h"
16 #include "grit/generated_resources.h"
17 #include "ui/base/l10n/l10n_util.h"
21 void ShowBadFlagsPrompt(Browser
* browser
) {
22 content::WebContents
* web_contents
=
23 browser
->tab_strip_model()->GetActiveWebContents();
27 // Unsupported flags for which to display a warning that "stability and
28 // security will suffer".
29 static const char* kBadFlags
[] = {
30 // These imply disabling the sandbox.
31 switches::kSingleProcess
,
33 switches::kDisableWebSecurity
,
34 // Browser plugin is dangerous on regular pages because it breaks the Same
36 switches::kEnableBrowserPluginForAllViewTypes
,
37 extensions::switches::kExtensionsOnChromeURLs
,
38 // This parameter should be used only for server side developments.
39 switches::kTranslateScriptURL
,
40 translate::switches::kTranslateSecurityOrigin
,
41 #if defined(ENABLE_WEBRTC)
42 // This flag disables security of media packets in WebRTC.
43 switches::kDisableWebRtcEncryption
,
48 for (const char** flag
= kBadFlags
; *flag
; ++flag
) {
49 if (CommandLine::ForCurrentProcess()->HasSwitch(*flag
)) {
50 SimpleAlertInfoBarDelegate::Create(
51 InfoBarService::FromWebContents(web_contents
),
52 InfoBarDelegate::kNoIconID
,
53 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE
,
55 std::string("--") + *flag
)),