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/" |
msw
2014/02/04 00:58:20
The style guide allows string literals to exceed 8
Yuki
2014/02/04 03:03:07
Done.
| |
29 const char kLearnMoreUrl[] = "https://groups.google.com/a/googleproductforums.co m/d/topic/chrome/Xrco2HsXS-8/discussion"; | 29 "djcfdncoelnlbldjfhinnjlhdjlikmph"; |
30 const char kDarkThemeSearchUrl[] = | |
31 "https://chrome.google.com/webstore/search-themes/dark"; | |
32 const char kLearnMoreUrl[] = | |
33 "https://groups.google.com/a/googleproductforums.com/d/topic/chrome/" | |
34 "Xrco2HsXS-8/discussion"; | |
30 const int kBubbleWidth = 500; | 35 const int kBubbleWidth = 500; |
31 | 36 |
32 class InvertBubbleView : public views::BubbleDelegateView, | 37 class InvertBubbleView : public views::BubbleDelegateView, |
33 public views::LinkListener { | 38 public views::LinkListener { |
34 public: | 39 public: |
35 InvertBubbleView(Browser* browser, views::View* anchor_view); | 40 InvertBubbleView(Browser* browser, views::View* anchor_view); |
36 virtual ~InvertBubbleView(); | 41 virtual ~InvertBubbleView(); |
37 | 42 |
38 private: | 43 private: |
39 // Overridden from views::BubbleDelegateView: | 44 // Overridden from views::BubbleDelegateView: |
(...skipping 26 matching lines...) Expand all Loading... | |
66 InvertBubbleView::~InvertBubbleView() { | 71 InvertBubbleView::~InvertBubbleView() { |
67 } | 72 } |
68 | 73 |
69 void InvertBubbleView::Init() { | 74 void InvertBubbleView::Init() { |
70 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 75 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
71 const gfx::FontList& original_font_list = | 76 const gfx::FontList& original_font_list = |
72 rb.GetFontList(ui::ResourceBundle::MediumFont); | 77 rb.GetFontList(ui::ResourceBundle::MediumFont); |
73 | 78 |
74 views::Label* title = new views::Label( | 79 views::Label* title = new views::Label( |
75 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION), | 80 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_NOTIFICATION), |
76 original_font_list.DeriveFontListWithSizeDeltaAndStyle(2, | 81 original_font_list.Derive(2, gfx::Font::BOLD)); |
77 gfx::Font::BOLD)); | |
78 title->SetMultiLine(true); | 82 title->SetMultiLine(true); |
79 title->SizeToFit(kBubbleWidth); | 83 title->SizeToFit(kBubbleWidth); |
80 | 84 |
81 learn_more_ = new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 85 learn_more_ = new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
82 learn_more_->SetFontList(original_font_list); | 86 learn_more_->SetFontList(original_font_list); |
83 learn_more_->set_listener(this); | 87 learn_more_->set_listener(this); |
84 | 88 |
85 high_contrast_ = | 89 high_contrast_ = |
86 new views::Link(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_EXT)); | 90 new views::Link(l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_EXT)); |
87 high_contrast_->SetFontList(original_font_list); | 91 high_contrast_->SetFontList(original_font_list); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 if (gfx::IsInvertedColorScheme() && | 168 if (gfx::IsInvertedColorScheme() && |
165 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 169 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
166 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 170 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
167 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor_view); | 171 InvertBubbleView* delegate = new InvertBubbleView(browser, anchor_view); |
168 views::BubbleDelegateView::CreateBubble(delegate); | 172 views::BubbleDelegateView::CreateBubble(delegate); |
169 delegate->StartFade(true); | 173 delegate->StartFade(true); |
170 } | 174 } |
171 } | 175 } |
172 | 176 |
173 } // namespace chrome | 177 } // namespace chrome |
OLD | NEW |