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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.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/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
11 #include "content/public/browser/page_navigator.h" | 11 #include "content/public/browser/page_navigator.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
16 #include "ui/gfx/sys_color_change_listener.h" | 16 #include "ui/gfx/sys_color_change_listener.h" |
17 #include "ui/views/bubble/bubble_delegate.h" | 17 #include "ui/views/bubble/bubble_delegate.h" |
18 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
19 #include "ui/views/controls/link.h" | 19 #include "ui/views/controls/link.h" |
20 #include "ui/views/controls/link_listener.h" | 20 #include "ui/views/controls/link_listener.h" |
21 #include "ui/views/layout/grid_layout.h" | 21 #include "ui/views/layout/grid_layout.h" |
22 #include "ui/views/layout/layout_constants.h" | 22 #include "ui/views/layout/layout_constants.h" |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const char kHighContrastExtensionUrl[] = "https://chrome.google.com/webstore/det
ail/djcfdncoelnlbldjfhinnjlhdjlikmph"; | 27 const char kHighContrastExtensionUrl[] = |
28 const char kDarkThemeSearchUrl[] = "https://chrome.google.com/webstore/search-th
emes/dark"; | 28 "https://chrome.google.com/webstore/detail/djcfdncoelnlbldjfhinnjlhdjlikmph"
; |
29 const char kLearnMoreUrl[] = "https://groups.google.com/a/googleproductforums.co
m/d/topic/chrome/Xrco2HsXS-8/discussion"; | 29 const char kDarkThemeSearchUrl[] = |
| 30 "https://chrome.google.com/webstore/search-themes/dark"; |
| 31 const char kLearnMoreUrl[] = |
| 32 "https://groups.google.com/a/googleproductforums.com/d/topic/chrome/Xrco2HsX
S-8/discussion"; |
30 const int kBubbleWidth = 500; | 33 const int kBubbleWidth = 500; |
31 | 34 |
32 class InvertBubbleView : public views::BubbleDelegateView, | 35 class InvertBubbleView : public views::BubbleDelegateView, |
33 public views::LinkListener { | 36 public views::LinkListener { |
34 public: | 37 public: |
35 InvertBubbleView(Browser* browser, views::View* anchor_view); | 38 InvertBubbleView(Browser* browser, views::View* anchor_view); |
36 virtual ~InvertBubbleView(); | 39 virtual ~InvertBubbleView(); |
37 | 40 |
38 private: | 41 private: |
39 // Overridden from views::BubbleDelegateView: | 42 // Overridden from views::BubbleDelegateView: |
(...skipping 26 matching lines...) Expand all Loading... |
66 InvertBubbleView::~InvertBubbleView() { | 69 InvertBubbleView::~InvertBubbleView() { |
67 } | 70 } |
68 | 71 |
69 void InvertBubbleView::Init() { | 72 void InvertBubbleView::Init() { |
70 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
71 const gfx::FontList& original_font_list = | 74 const gfx::FontList& original_font_list = |
72 rb.GetFontList(ui::ResourceBundle::MediumFont); | 75 rb.GetFontList(ui::ResourceBundle::MediumFont); |
73 | 76 |
74 views::Label* title = new views::Label( | 77 views::Label* title = new views::Label( |
75 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION), | 78 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION), |
76 original_font_list.DeriveFontListWithSizeDeltaAndStyle(2, | 79 original_font_list.Derive(2, gfx::Font::BOLD)); |
77 gfx::Font::BOLD)); | |
78 title->SetMultiLine(true); | 80 title->SetMultiLine(true); |
79 title->SizeToFit(kBubbleWidth); | 81 title->SizeToFit(kBubbleWidth); |
80 | 82 |
81 learn_more_ = new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 83 learn_more_ = new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
82 learn_more_->SetFontList(original_font_list); | 84 learn_more_->SetFontList(original_font_list); |
83 learn_more_->set_listener(this); | 85 learn_more_->set_listener(this); |
84 | 86 |
85 high_contrast_ = | 87 high_contrast_ = |
86 new views::Link(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_EXT)); | 88 new views::Link(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_EXT)); |
87 high_contrast_->SetFontList(original_font_list); | 89 high_contrast_->SetFontList(original_font_list); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (gfx::IsInvertedColorScheme() && | 166 if (gfx::IsInvertedColorScheme() && |
165 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 167 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
166 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 168 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
167 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor_view); | 169 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor_view); |
168 views::BubbleDelegateView::CreateBubble(delegate); | 170 views::BubbleDelegateView::CreateBubble(delegate); |
169 delegate->StartFade(true); | 171 delegate->StartFade(true); |
170 } | 172 } |
171 } | 173 } |
172 | 174 |
173 } // namespace chrome | 175 } // namespace chrome |
OLD | NEW |