| 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/page_info/website_settings_popup_view.h" | 9 #include "chrome/browser/ui/views/page_info/page_info_popup_view.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "chrome/grit/theme_resources.h" | 11 #include "chrome/grit/theme_resources.h" |
| 12 #include "components/grit/components_scaled_resources.h" | 12 #include "components/grit/components_scaled_resources.h" |
| 13 #include "components/omnibox/browser/omnibox_edit_model.h" | 13 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "ui/accessibility/ax_node_data.h" | 15 #include "ui/accessibility/ax_node_data.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 18 | 18 |
| 19 using content::WebContents; | 19 using content::WebContents; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 base::string16 text; | 48 base::string16 text; |
| 49 ui::Clipboard::GetForCurrentThread()->ReadText( | 49 ui::Clipboard::GetForCurrentThread()->ReadText( |
| 50 ui::CLIPBOARD_TYPE_SELECTION, &text); | 50 ui::CLIPBOARD_TYPE_SELECTION, &text); |
| 51 text = OmniboxView::SanitizeTextForPaste(text); | 51 text = OmniboxView::SanitizeTextForPaste(text); |
| 52 OmniboxEditModel* model = location_bar_->GetOmniboxView()->model(); | 52 OmniboxEditModel* model = location_bar_->GetOmniboxView()->model(); |
| 53 if (model->CanPasteAndGo(text)) | 53 if (model->CanPasteAndGo(text)) |
| 54 model->PasteAndGo(text); | 54 model->PasteAndGo(text); |
| 55 } | 55 } |
| 56 | 56 |
| 57 suppress_mouse_released_action_ = | 57 suppress_mouse_released_action_ = |
| 58 WebsiteSettingsPopupView::GetShownPopupType() != | 58 PageInfoPopupView::GetShownPopupType() != PageInfoPopupView::POPUP_NONE; |
| 59 WebsiteSettingsPopupView::POPUP_NONE; | |
| 60 return true; | 59 return true; |
| 61 } | 60 } |
| 62 | 61 |
| 63 bool LocationIconView::OnMouseDragged(const ui::MouseEvent& event) { | 62 bool LocationIconView::OnMouseDragged(const ui::MouseEvent& event) { |
| 64 location_bar_->GetOmniboxView()->CloseOmniboxPopup(); | 63 location_bar_->GetOmniboxView()->CloseOmniboxPopup(); |
| 65 return false; | 64 return false; |
| 66 } | 65 } |
| 67 | 66 |
| 68 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { | 67 void LocationIconView::OnMouseReleased(const ui::MouseEvent& event) { |
| 69 if (event.IsOnlyMiddleMouseButton()) | 68 if (event.IsOnlyMiddleMouseButton()) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 95 } | 94 } |
| 96 | 95 |
| 97 SkColor LocationIconView::GetTextColor() const { | 96 SkColor LocationIconView::GetTextColor() const { |
| 98 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT); | 97 return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT); |
| 99 } | 98 } |
| 100 | 99 |
| 101 bool LocationIconView::OnActivate(const ui::Event& event) { | 100 bool LocationIconView::OnActivate(const ui::Event& event) { |
| 102 WebContents* contents = location_bar_->GetWebContents(); | 101 WebContents* contents = location_bar_->GetWebContents(); |
| 103 if (!contents) | 102 if (!contents) |
| 104 return false; | 103 return false; |
| 105 location_bar_->delegate()->ShowWebsiteSettings(contents); | 104 location_bar_->delegate()->ShowPageInfo(contents); |
| 106 return true; | 105 return true; |
| 107 } | 106 } |
| 108 | 107 |
| 109 void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 108 void LocationIconView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 110 IconLabelBubbleView::GetAccessibleNodeData(node_data); | 109 IconLabelBubbleView::GetAccessibleNodeData(node_data); |
| 111 node_data->role = ui::AX_ROLE_POP_UP_BUTTON; | 110 node_data->role = ui::AX_ROLE_POP_UP_BUTTON; |
| 112 } | 111 } |
| 113 | 112 |
| 114 gfx::Size LocationIconView::GetMinimumSizeForLabelText( | 113 gfx::Size LocationIconView::GetMinimumSizeForLabelText( |
| 115 const base::string16& text) const { | 114 const base::string16& text) const { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return size; | 152 return size; |
| 154 } | 153 } |
| 155 | 154 |
| 156 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { | 155 void LocationIconView::OnClickOrTap(const ui::LocatedEvent& event) { |
| 157 // Do not show page info if the user has been editing the location bar or the | 156 // Do not show page info if the user has been editing the location bar or the |
| 158 // location bar is at the NTP. | 157 // location bar is at the NTP. |
| 159 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) | 158 if (location_bar_->GetOmniboxView()->IsEditingOrEmpty()) |
| 160 return; | 159 return; |
| 161 ProcessLocatedEvent(event); | 160 ProcessLocatedEvent(event); |
| 162 } | 161 } |
| OLD | NEW |