| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/views/conflicting_module_view_win.h" | 5 #include "chrome/browser/ui/views/conflicting_module_view_win.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/user_metrics.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/layout_constants.h" | 12 #include "chrome/browser/ui/layout_constants.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "chrome/grit/locale_settings.h" | 16 #include "chrome/grit/locale_settings.h" |
| 16 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
| 17 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| 18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/browser/user_metrics.h" | |
| 20 #include "ui/accessibility/ax_node_data.h" | 20 #include "ui/accessibility/ax_node_data.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
| 24 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
| 26 #include "ui/views/layout/layout_constants.h" | 26 #include "ui/views/layout/layout_constants.h" |
| 27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 | 28 |
| 29 using base::UserMetricsAction; | 29 using base::UserMetricsAction; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 IntegerPrefMember bubble_shown; | 104 IntegerPrefMember bubble_shown; |
| 105 bubble_shown.Init( | 105 bubble_shown.Init( |
| 106 prefs::kModuleConflictBubbleShown, | 106 prefs::kModuleConflictBubbleShown, |
| 107 browser_->profile()->GetPrefs()); | 107 browser_->profile()->GetPrefs()); |
| 108 bubble_shown.SetValue(bubble_shown.GetValue() + 1); | 108 bubble_shown.SetValue(bubble_shown.GetValue() + 1); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ConflictingModuleView::OnWidgetClosing(views::Widget* widget) { | 111 void ConflictingModuleView::OnWidgetClosing(views::Widget* widget) { |
| 112 views::BubbleDialogDelegateView::OnWidgetClosing(widget); | 112 views::BubbleDialogDelegateView::OnWidgetClosing(widget); |
| 113 content::RecordAction( | 113 base::RecordAction( |
| 114 UserMetricsAction("ConflictingModuleNotificationDismissed")); | 114 UserMetricsAction("ConflictingModuleNotificationDismissed")); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool ConflictingModuleView::Accept() { | 117 bool ConflictingModuleView::Accept() { |
| 118 browser_->OpenURL( | 118 browser_->OpenURL( |
| 119 content::OpenURLParams(help_center_url_, content::Referrer(), | 119 content::OpenURLParams(help_center_url_, content::Referrer(), |
| 120 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 120 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 121 ui::PAGE_TRANSITION_LINK, false)); | 121 ui::PAGE_TRANSITION_LINK, false)); |
| 122 EnumerateModulesModel::GetInstance()->AcknowledgeConflictNotification(); | 122 EnumerateModulesModel::GetInstance()->AcknowledgeConflictNotification(); |
| 123 return true; | 123 return true; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 143 | 143 |
| 144 views::Label* explanation = new views::Label(); | 144 views::Label* explanation = new views::Label(); |
| 145 explanation->SetMultiLine(true); | 145 explanation->SetMultiLine(true); |
| 146 explanation->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 146 explanation->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 147 explanation->SetText( | 147 explanation->SetText( |
| 148 l10n_util::GetStringUTF16(IDS_OPTIONS_CONFLICTING_MODULE)); | 148 l10n_util::GetStringUTF16(IDS_OPTIONS_CONFLICTING_MODULE)); |
| 149 explanation->SizeToFit(views::Widget::GetLocalizedContentsWidth( | 149 explanation->SizeToFit(views::Widget::GetLocalizedContentsWidth( |
| 150 IDS_CONFLICTING_MODULE_BUBBLE_WIDTH_CHARS)); | 150 IDS_CONFLICTING_MODULE_BUBBLE_WIDTH_CHARS)); |
| 151 AddChildView(explanation); | 151 AddChildView(explanation); |
| 152 | 152 |
| 153 content::RecordAction( | 153 base::RecordAction(UserMetricsAction("ConflictingModuleNotificationShown")); |
| 154 UserMetricsAction("ConflictingModuleNotificationShown")); | |
| 155 | 154 |
| 156 UMA_HISTOGRAM_ENUMERATION("ConflictingModule.UserSelection", | 155 UMA_HISTOGRAM_ENUMERATION("ConflictingModule.UserSelection", |
| 157 EnumerateModulesModel::ACTION_BUBBLE_SHOWN, | 156 EnumerateModulesModel::ACTION_BUBBLE_SHOWN, |
| 158 EnumerateModulesModel::ACTION_BOUNDARY); | 157 EnumerateModulesModel::ACTION_BOUNDARY); |
| 159 } | 158 } |
| 160 | 159 |
| 161 void ConflictingModuleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 160 void ConflictingModuleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 162 node_data->role = ui::AX_ROLE_ALERT_DIALOG; | 161 node_data->role = ui::AX_ROLE_ALERT_DIALOG; |
| 163 } | 162 } |
| 164 | 163 |
| 165 void ConflictingModuleView::OnConflictsAcknowledged() { | 164 void ConflictingModuleView::OnConflictsAcknowledged() { |
| 166 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); | 165 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); |
| 167 if (!model->ShouldShowConflictWarning()) | 166 if (!model->ShouldShowConflictWarning()) |
| 168 GetWidget()->Close(); | 167 GetWidget()->Close(); |
| 169 } | 168 } |
| OLD | NEW |