OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/location_bar/star_view.h" | 5 #include "chrome/browser/ui/views/location_bar/star_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 StarView::~StarView() { | 24 StarView::~StarView() { |
25 } | 25 } |
26 | 26 |
27 void StarView::SetToggled(bool on) { | 27 void StarView::SetToggled(bool on) { |
28 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( | 28 SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16( |
29 on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR))); | 29 on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR))); |
30 // Since StarView is an ImageView, the SetTooltipText changes the accessible | 30 // Since StarView is an ImageView, the SetTooltipText changes the accessible |
31 // name. To keep the accessible name unchanged, we need to set the accessible | 31 // name. To keep the accessible name unchanged, we need to set the accessible |
32 // name right after we modify the tooltip text for this view. | 32 // name right after we modify the tooltip text for this view. |
33 SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_STAR))); | 33 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ACCNAME_STAR)); |
34 SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed( | 34 SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed( |
35 on ? IDR_STAR_LIT : IDR_STAR)); | 35 on ? IDR_STAR_LIT : IDR_STAR)); |
36 } | 36 } |
37 | 37 |
38 AccessibilityTypes::Role StarView::GetAccessibleRole() { | 38 AccessibilityTypes::Role StarView::GetAccessibleRole() { |
39 return AccessibilityTypes::ROLE_PUSHBUTTON; | 39 return AccessibilityTypes::ROLE_PUSHBUTTON; |
40 } | 40 } |
41 | 41 |
42 bool StarView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { | 42 bool StarView::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { |
43 // Don't show tooltip to distract user if BookmarkBubbleView is showing. | 43 // Don't show tooltip to distract user if BookmarkBubbleView is showing. |
(...skipping 23 matching lines...) Expand all Loading... |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 void StarView::InfoBubbleClosing(InfoBubble* info_bubble, | 70 void StarView::InfoBubbleClosing(InfoBubble* info_bubble, |
71 bool closed_by_escape) { | 71 bool closed_by_escape) { |
72 } | 72 } |
73 | 73 |
74 bool StarView::CloseOnEscape() { | 74 bool StarView::CloseOnEscape() { |
75 return true; | 75 return true; |
76 } | 76 } |
OLD | NEW |