| 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/views/accessibility/invert_bubble_view.h" | 5 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 12 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 13 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
| 17 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| 18 #include "content/public/browser/page_navigator.h" | 19 #include "content/public/browser/page_navigator.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/base/window_open_disposition.h" | 22 #include "ui/base/window_open_disposition.h" |
| 22 #include "ui/gfx/color_utils.h" | 23 #include "ui/gfx/color_utils.h" |
| 23 #include "ui/views/bubble/bubble_dialog_delegate.h" | 24 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 24 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/controls/link.h" | 26 #include "ui/views/controls/link.h" |
| 26 #include "ui/views/controls/link_listener.h" | 27 #include "ui/views/controls/link_listener.h" |
| 27 #include "ui/views/layout/grid_layout.h" | 28 #include "ui/views/layout/grid_layout.h" |
| 28 #include "ui/views/layout/layout_constants.h" | |
| 29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const char kHighContrastExtensionUrl[] = | 33 const char kHighContrastExtensionUrl[] = |
| 34 "https://chrome.google.com/webstore/detail/djcfdncoelnlbldjfhinnjlhdjlikmph"
; | 34 "https://chrome.google.com/webstore/detail/djcfdncoelnlbldjfhinnjlhdjlikmph"
; |
| 35 const char kDarkThemeSearchUrl[] = | 35 const char kDarkThemeSearchUrl[] = |
| 36 "https://chrome.google.com/webstore/search-themes/dark"; | 36 "https://chrome.google.com/webstore/search-themes/dark"; |
| 37 const char kLearnMoreUrl[] = | 37 const char kLearnMoreUrl[] = |
| 38 "https://groups.google.com/a/googleproductforums.com/d/topic/chrome/Xrco2HsX
S-8/discussion"; | 38 "https://groups.google.com/a/googleproductforums.com/d/topic/chrome/Xrco2HsX
S-8/discussion"; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 views::ColumnSet* columns = layout->AddColumnSet(0); | 113 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 114 for (int i = 0; i < 4; i++) { | 114 for (int i = 0; i < 4; i++) { |
| 115 columns->AddColumn(views::GridLayout::LEADING, | 115 columns->AddColumn(views::GridLayout::LEADING, |
| 116 views::GridLayout::LEADING, 0, | 116 views::GridLayout::LEADING, 0, |
| 117 views::GridLayout::USE_PREF, 0, 0); | 117 views::GridLayout::USE_PREF, 0, 0); |
| 118 } | 118 } |
| 119 | 119 |
| 120 layout->StartRow(0, 0); | 120 layout->StartRow(0, 0); |
| 121 layout->AddView(title, 4, 1); | 121 layout->AddView(title, 4, 1); |
| 122 layout->StartRowWithPadding(0, 0, 0, | 122 layout->StartRowWithPadding(0, 0, 0, |
| 123 views::kRelatedControlSmallVerticalSpacing); | 123 ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 124 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL)); |
| 124 layout->AddView(high_contrast_); | 125 layout->AddView(high_contrast_); |
| 125 layout->AddView(dark_theme_); | 126 layout->AddView(dark_theme_); |
| 126 layout->AddView(learn_more_); | 127 layout->AddView(learn_more_); |
| 127 layout->AddView(close_); | 128 layout->AddView(close_); |
| 128 | 129 |
| 129 // Fit the message to the width of the links in the bubble. | 130 // Fit the message to the width of the links in the bubble. |
| 130 const gfx::Size size(GetPreferredSize()); | 131 const gfx::Size size(GetPreferredSize()); |
| 131 title->SetText(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION)); | 132 title->SetText(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION)); |
| 132 title->SizeToFit(size.width()); | 133 title->SizeToFit(size.width()); |
| 133 | 134 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 views::View* anchor = browser_view->toolbar()->app_menu_button(); | 175 views::View* anchor = browser_view->toolbar()->app_menu_button(); |
| 175 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && | 176 if (color_utils::IsInvertedColorScheme() && anchor && anchor->GetWidget() && |
| 176 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 177 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
| 177 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 178 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
| 178 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); | 179 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor); |
| 179 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); | 180 views::BubbleDialogDelegateView::CreateBubble(delegate)->Show(); |
| 180 } | 181 } |
| 181 } | 182 } |
| 182 | 183 |
| 183 } // namespace chrome | 184 } // namespace chrome |
| OLD | NEW |