diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 18:09:42 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-01 18:09:42 +0000 |
commit | 938e1f9ec9e6e1d267dbff0c9bb50d5952937bc7 (patch) | |
tree | 9cdb9a05dcc70199710f399885f737b0642ee211 /chrome/browser/browser_init.cc | |
parent | 4dcbeb4a725e61ebec6b28162f9a495e64c2a96f (diff) | |
download | chromium_src-938e1f9ec9e6e1d267dbff0c9bb50d5952937bc7.zip chromium_src-938e1f9ec9e6e1d267dbff0c9bb50d5952937bc7.tar.gz chromium_src-938e1f9ec9e6e1d267dbff0c9bb50d5952937bc7.tar.bz2 |
Show an infobar when the user is using an unsupported flag.
Patch stolen from Evan and a translatable string added:
<http://codereview.chromium.org/490019>.
BUG=40113
TEST=Run Chromium with --no-sandbox; should get an infobar warning that you're going to die young.
Review URL: http://codereview.chromium.org/1599010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_init.cc')
-rw-r--r-- | chrome/browser/browser_init.cc | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 8baddcd..a18558f 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -221,8 +221,6 @@ class CheckDefaultBrowserTask : public Task { // A delegate for the InfoBar shown when the previous session has crashed. The // bar deletes itself automatically after it is closed. -// TODO(timsteele): This delegate can leak when a tab is closed, see -// http://crbug.com/6520 class SessionCrashedInfoBarDelegate : public ConfirmInfoBarDelegate { public: explicit SessionCrashedInfoBarDelegate(TabContents* contents) @@ -738,8 +736,10 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser( tabs[i].url, GURL(), PageTransition::START_PAGE, -1, add_types, NULL, tabs[i].app_id); - if (profile_ && first_tab && process_startup) + if (profile_ && first_tab && process_startup) { AddCrashedInfoBarIfNecessary(tab); + AddBadFlagsInfoBarIfNecessary(tab); + } first_tab = false; } @@ -764,6 +764,32 @@ void BrowserInit::LaunchWithProfile::AddCrashedInfoBarIfNecessary( } } +void BrowserInit::LaunchWithProfile::AddBadFlagsInfoBarIfNecessary( + TabContents* tab) { + // Unsupported flags for which to display a warning that "stability and + // security will suffer". + static const char* kBadFlags[] = { + switches::kSingleProcess, + switches::kNoSandbox, + NULL + }; + + const char* bad_flag = NULL; + for (const char** flag = kBadFlags; *flag; ++flag) { + if (command_line_.HasSwitch(*flag)) { + bad_flag = *flag; + break; + } + } + + if (bad_flag) { + tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab, + l10n_util::GetStringF(IDS_BAD_FLAGS_WARNING_MESSAGE, + L"--" + ASCIIToWide(bad_flag)), + NULL, false)); + } +} + std::vector<GURL> BrowserInit::LaunchWithProfile::GetURLsFromCommandLine( Profile* profile) { std::vector<GURL> urls; |