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