blob: b10e9cc7ea95797e6fa39361ce1e9ff8b1bf7ea3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/startup/bad_flags_prompt.h"
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
namespace chrome {
void ShowBadFlagsPrompt(Browser* browser) {
// Unsupported flags for which to display a warning that "stability and
// security will suffer".
static const char* kBadFlags[] = {
// These imply disabling the sandbox.
switches::kSingleProcess,
switches::kNoSandbox,
switches::kInProcessWebGL,
switches::kDisableWebSecurity,
NULL
};
const char* bad_flag = NULL;
for (const char** flag = kBadFlags; *flag; ++flag) {
if (CommandLine::ForCurrentProcess()->HasSwitch(*flag)) {
bad_flag = *flag;
break;
}
}
if (bad_flag) {
TabContents* tab = chrome::GetActiveTabContents(browser);
if (!tab)
return;
tab->infobar_tab_helper()->AddInfoBar(
new SimpleAlertInfoBarDelegate(
tab->infobar_tab_helper(), NULL,
l10n_util::GetStringFUTF16(
IDS_BAD_FLAGS_WARNING_MESSAGE,
UTF8ToUTF16(std::string("--") + bad_flag)),
false));
}
}
} // namespace chrome
|