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/profile_error_dialog.h" | 5 #include "chrome/browser/ui/profile_error_dialog.h" |
6 | 6 |
7 #include "base/auto_reset.h" | |
8 #include "base/base_switches.h" | |
9 #include "base/command_line.h" | |
7 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/ui/simple_message_box.h" | 11 #include "chrome/browser/ui/simple_message_box.h" |
9 #include "chrome/grit/chromium_strings.h" | 12 #include "chrome/grit/chromium_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
11 | 14 |
15 namespace { | |
16 bool is_showing_profile_error_dialog = false; | |
Peter Kasting
2015/01/26 19:52:46
Nit: A static bool inside the method would be clea
robwu
2015/01/26 23:26:21
Done.
| |
17 } // namespace | |
18 | |
12 void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { | 19 void ShowProfileErrorDialog(ProfileErrorType type, int message_id) { |
13 #if defined(OS_ANDROID) || defined(OS_IOS) | 20 #if defined(OS_ANDROID) || defined(OS_IOS) |
14 NOTIMPLEMENTED(); | 21 NOTIMPLEMENTED(); |
15 #else | 22 #else |
16 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); | 23 UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END); |
17 chrome::ShowMessageBox(NULL, | 24 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
18 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 25 switches::kNoErrorDialogs)) |
Peter Kasting
2015/01/26 19:52:46
I wonder if this should be in ShowMessageBox() ins
robwu
2015/01/26 23:26:21
At least ShowWarningMessageBox in chrome/browser/c
Peter Kasting
2015/01/27 00:20:32
Are you sure that should be shown when --noerrdial
robwu
2015/01/27 22:03:47
I'm not sure about that, but I'm definitely to not
| |
19 l10n_util::GetStringUTF16(message_id), | 26 return; |
20 chrome::MESSAGE_BOX_TYPE_WARNING); | 27 if (!is_showing_profile_error_dialog) { |
28 base::AutoReset<bool> resetter(&is_showing_profile_error_dialog, true); | |
Peter Kasting
2015/01/26 19:52:46
If this actually works to eliminate duplicate dial
robwu
2015/01/26 23:26:21
If you follow the calls, then you'll indeed see a
Peter Kasting
2015/01/27 00:20:32
That seems very, very bad. I would imagine this c
robwu
2015/01/27 22:03:47
Can you follow up with the right people? As a memb
| |
29 chrome::ShowMessageBox(NULL, | |
30 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | |
31 l10n_util::GetStringUTF16(message_id), | |
32 chrome::MESSAGE_BOX_TYPE_WARNING); | |
33 } | |
21 #endif | 34 #endif |
22 } | 35 } |
OLD | NEW |