Chromium Code Reviews| 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/location_bar/location_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/view_ids.h" | 7 #include "chrome/browser/ui/view_ids.h" |
| 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " | 9 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 | 81 |
| 82 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { | 82 void LocationIconView::OnGestureEvent(ui::GestureEvent* event) { |
| 83 if (event->type() != ui::ET_GESTURE_TAP) | 83 if (event->type() != ui::ET_GESTURE_TAP) |
| 84 return; | 84 return; |
| 85 OnClickOrTap(*event); | 85 OnClickOrTap(*event); |
| 86 event->SetHandled(); | 86 event->SetHandled(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool LocationIconView::GetTooltipText(const gfx::Point& p, | 89 bool LocationIconView::GetTooltipText(const gfx::Point& p, |
| 90 base::string16* tooltip) const { | 90 base::string16* tooltip) const { |
| 91 if (show_tooltip_) | 91 if (show_tooltip_) { |
| 92 *tooltip = l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON); | 92 base::string16 tip = l10n_util::GetStringUTF16(IDS_TOOLTIP_LOCATION_ICON); |
| 93 // Prepend the verbose text of the security chip, if any. | |
| 94 if (!label()->text().empty()) | |
| 95 tip = label()->text() + base::ASCIIToUTF16(". ") + tip; | |
|
Peter Kasting
2017/03/14 19:54:56
This isn't OK for l10n -- if we're going to constr
| |
| 96 *tooltip = tip; | |
| 97 } | |
| 93 return show_tooltip_; | 98 return show_tooltip_; |
| 94 } | 99 } |
| 95 | 100 |
| 96 SkColor LocationIconView::GetTextColor() const { | 101 SkColor LocationIconView::GetTextColor() const { |
| 97 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT); | 102 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT); |
| 98 } | 103 } |
| 99 | 104 |
| 100 bool LocationIconView::OnActivate(const ui::Event& event) { | 105 bool LocationIconView::OnActivate(const ui::Event& event) { |
| 101 WebContents* contents = location_bar_->GetWebContents(); | 106 WebContents* contents = location_bar_->GetWebContents(); |
| 102 if (!contents) | 107 if (!contents) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 return size; | 157 return size; |
| 153 } | 158 } |
| 154 | 159 |
| 155 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { | 160 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { |
| 156 // Do not show page info if the user has been editing the location bar or the | 161 // Do not show page info if the user has been editing the location bar or the |
| 157 // location bar is at the NTP. | 162 // location bar is at the NTP. |
| 158 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) | 163 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) |
| 159 return; | 164 return; |
| 160 ProcessLocatedEvent(event); | 165 ProcessLocatedEvent(event); |
| 161 } | 166 } |
| OLD | NEW |