| 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 "base/metrics/user_metrics.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 13 #include "chrome/browser/ui/layout_constants.h" | 13 #include "chrome/browser/ui/layout_constants.h" |
| 14 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/grit/chromium_strings.h" | 16 #include "chrome/grit/chromium_strings.h" |
| 16 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "chrome/grit/locale_settings.h" | 18 #include "chrome/grit/locale_settings.h" |
| 18 #include "chrome/grit/theme_resources.h" | 19 #include "chrome/grit/theme_resources.h" |
| 19 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 21 #include "ui/accessibility/ax_node_data.h" | 22 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/views/controls/image_view.h" | 25 #include "ui/views/controls/image_view.h" |
| 25 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
| 26 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
| 27 #include "ui/views/layout/layout_constants.h" | |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 using base::UserMetricsAction; | 30 using base::UserMetricsAction; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // How often to show this bubble. | 34 // How often to show this bubble. |
| 35 const int kShowConflictingModuleBubbleMax = 3; | 35 const int kShowConflictingModuleBubbleMax = 3; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK | 131 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK |
| 132 ? IDS_CONFLICTS_LEARN_MORE | 132 ? IDS_CONFLICTS_LEARN_MORE |
| 133 : IDS_NOT_NOW); | 133 : IDS_NOT_NOW); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ConflictingModuleView::Init() { | 136 void ConflictingModuleView::Init() { |
| 137 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 137 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 138 | 138 |
| 139 SetLayoutManager( | 139 SetLayoutManager( |
| 140 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, | 140 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, |
| 141 views::kRelatedControlHorizontalSpacing)); | 141 ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 142 DISTANCE_RELATED_LABEL_HORIZONTAL))); |
| 142 | 143 |
| 143 views::ImageView* icon = new views::ImageView(); | 144 views::ImageView* icon = new views::ImageView(); |
| 144 icon->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT_MENU)); | 145 icon->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT_MENU)); |
| 145 AddChildView(icon); | 146 AddChildView(icon); |
| 146 | 147 |
| 147 views::Label* explanation = new views::Label(); | 148 views::Label* explanation = new views::Label(); |
| 148 explanation->SetMultiLine(true); | 149 explanation->SetMultiLine(true); |
| 149 explanation->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 150 explanation->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 150 explanation->SetText( | 151 explanation->SetText( |
| 151 l10n_util::GetStringUTF16(IDS_OPTIONS_CONFLICTING_MODULE)); | 152 l10n_util::GetStringUTF16(IDS_OPTIONS_CONFLICTING_MODULE)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 162 | 163 |
| 163 void ConflictingModuleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 164 void ConflictingModuleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 164 node_data->role = ui::AX_ROLE_ALERT_DIALOG; | 165 node_data->role = ui::AX_ROLE_ALERT_DIALOG; |
| 165 } | 166 } |
| 166 | 167 |
| 167 void ConflictingModuleView::OnConflictsAcknowledged() { | 168 void ConflictingModuleView::OnConflictsAcknowledged() { |
| 168 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); | 169 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); |
| 169 if (!model->ShouldShowConflictWarning()) | 170 if (!model->ShouldShowConflictWarning()) |
| 170 GetWidget()->Close(); | 171 GetWidget()->Close(); |
| 171 } | 172 } |
| OLD | NEW |