| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/accessibility/invert_bubble_views.h" | 6 #include "chrome/browser/accessibility/invert_bubble_views.h" |
| 7 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/views/event_utils.h" | 10 #include "chrome/browser/ui/views/event_utils.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 layout->StartRowWithPadding(0, 0, 0, | 75 layout->StartRowWithPadding(0, 0, 0, |
| 76 views::kRelatedControlSmallVerticalSpacing); | 76 views::kRelatedControlSmallVerticalSpacing); |
| 77 layout->AddView(learn_more); | 77 layout->AddView(learn_more); |
| 78 | 78 |
| 79 // Switching to high-contrast mode has a nasty habit of causing Chrome | 79 // Switching to high-contrast mode has a nasty habit of causing Chrome |
| 80 // top-level windows to lose focus, so closing the bubble on deactivate | 80 // top-level windows to lose focus, so closing the bubble on deactivate |
| 81 // makes it disappear before the user has even seen it. This forces the | 81 // makes it disappear before the user has even seen it. This forces the |
| 82 // user to close it explicitly, which should be okay because it affects | 82 // user to close it explicitly, which should be okay because it affects |
| 83 // a small minority of users, and only once. | 83 // a small minority of users, and only once. |
| 84 set_close_on_deactivate(false); | 84 set_close_on_deactivate(false); |
| 85 set_move_with_anchor(true); |
| 85 } | 86 } |
| 86 | 87 |
| 87 gfx::Rect InvertBubbleView::GetAnchorRect() { | 88 gfx::Rect InvertBubbleView::GetAnchorRect() { |
| 88 // Set the height to 0 so we display the bubble at the top of the | 89 // Set the height to 0 so we display the bubble at the top of the |
| 89 // anchor rect. | 90 // anchor rect. |
| 90 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); | 91 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); |
| 91 rect.set_height(0); | 92 rect.set_height(0); |
| 92 return rect; | 93 return rect; |
| 93 } | 94 } |
| 94 | 95 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 125 views::View* anchor_view) { | 126 views::View* anchor_view) { |
| 126 PrefService* pref_service = profile->GetPrefs(); | 127 PrefService* pref_service = profile->GetPrefs(); |
| 127 if (gfx::IsInvertedColorScheme() && | 128 if (gfx::IsInvertedColorScheme() && |
| 128 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { | 129 !pref_service->GetBoolean(prefs::kInvertNotificationShown)) { |
| 129 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); | 130 pref_service->SetBoolean(prefs::kInvertNotificationShown, true); |
| 130 InvertBubbleView* delegate = new InvertBubbleView(profile, anchor_view); | 131 InvertBubbleView* delegate = new InvertBubbleView(profile, anchor_view); |
| 131 views::BubbleDelegateView::CreateBubble(delegate); | 132 views::BubbleDelegateView::CreateBubble(delegate); |
| 132 delegate->StartFade(true); | 133 delegate->StartFade(true); |
| 133 } | 134 } |
| 134 } | 135 } |
| OLD | NEW |