| 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/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/simple_message_box.h" | 12 #include "chrome/browser/ui/simple_message_box.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/switch_utils.h" | 16 #include "chrome/common/switch_utils.h" |
| 17 #include "chrome/grit/chromium_strings.h" | 17 #include "chrome/grit/chromium_strings.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/infobars/core/simple_alert_infobar_delegate.h" | 19 #include "components/infobars/core/simple_alert_infobar_delegate.h" |
| 20 #include "components/invalidation/impl/invalidation_switches.h" | 20 #include "components/invalidation/impl/invalidation_switches.h" |
| 21 #include "components/nacl/common/nacl_switches.h" | 21 #include "components/nacl/common/nacl_switches.h" |
| 22 #include "components/startup_metric_utils/startup_metric_utils.h" | 22 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 23 #include "components/translate/core/common/translate_switches.h" | 23 #include "components/translate/core/common/translate_switches.h" |
| 24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "extensions/common/switches.h" | 25 #include "extensions/common/switches.h" |
| 26 #include "google_apis/gaia/gaia_switches.h" | 26 #include "google_apis/gaia/gaia_switches.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/gfx/vector_icons_public.h" |
| 29 | 30 |
| 30 namespace chrome { | 31 namespace chrome { |
| 31 | 32 |
| 32 void ShowBadFlagsPrompt(Browser* browser) { | 33 void ShowBadFlagsPrompt(Browser* browser) { |
| 33 content::WebContents* web_contents = | 34 content::WebContents* web_contents = |
| 34 browser->tab_strip_model()->GetActiveWebContents(); | 35 browser->tab_strip_model()->GetActiveWebContents(); |
| 35 if (!web_contents) | 36 if (!web_contents) |
| 36 return; | 37 return; |
| 37 | 38 |
| 38 // Unsupported flags for which to display a warning that "stability and | 39 // Unsupported flags for which to display a warning that "stability and |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 switches::kEnableWebUsbOnAnyOrigin, | 99 switches::kEnableWebUsbOnAnyOrigin, |
| 99 | 100 |
| 100 NULL | 101 NULL |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 for (const char** flag = kBadFlags; *flag; ++flag) { | 104 for (const char** flag = kBadFlags; *flag; ++flag) { |
| 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { | 105 if (base::CommandLine::ForCurrentProcess()->HasSwitch(*flag)) { |
| 105 SimpleAlertInfoBarDelegate::Create( | 106 SimpleAlertInfoBarDelegate::Create( |
| 106 InfoBarService::FromWebContents(web_contents), | 107 InfoBarService::FromWebContents(web_contents), |
| 107 infobars::InfoBarDelegate::kNoIconID, | 108 infobars::InfoBarDelegate::kNoIconID, |
| 108 l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE, | 109 gfx::VectorIconId::VECTOR_ICON_NONE, |
| 109 base::UTF8ToUTF16( | 110 l10n_util::GetStringFUTF16( |
| 110 std::string("--") + *flag)), | 111 IDS_BAD_FLAGS_WARNING_MESSAGE, |
| 112 base::UTF8ToUTF16(std::string("--") + *flag)), |
| 111 false); | 113 false); |
| 112 return; | 114 return; |
| 113 } | 115 } |
| 114 } | 116 } |
| 115 } | 117 } |
| 116 | 118 |
| 117 void MaybeShowInvalidUserDataDirWarningDialog() { | 119 void MaybeShowInvalidUserDataDirWarningDialog() { |
| 118 const base::FilePath& user_data_dir = GetInvalidSpecifiedUserDataDir(); | 120 const base::FilePath& user_data_dir = GetInvalidSpecifiedUserDataDir(); |
| 119 if (user_data_dir.empty()) | 121 if (user_data_dir.empty()) |
| 120 return; | 122 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 140 user_data_dir.LossyDisplayName()); | 142 user_data_dir.LossyDisplayName()); |
| 141 | 143 |
| 142 if (cleanup_resource_bundle) | 144 if (cleanup_resource_bundle) |
| 143 ResourceBundle::CleanupSharedInstance(); | 145 ResourceBundle::CleanupSharedInstance(); |
| 144 | 146 |
| 145 // More complex dialogs cannot be shown before the earliest calls here. | 147 // More complex dialogs cannot be shown before the earliest calls here. |
| 146 ShowMessageBox(NULL, title, message, chrome::MESSAGE_BOX_TYPE_WARNING); | 148 ShowMessageBox(NULL, title, message, chrome::MESSAGE_BOX_TYPE_WARNING); |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace chrome | 151 } // namespace chrome |
| OLD | NEW |