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/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 virtual bool GetTooltipText(const gfx::Point& p, | 162 virtual bool GetTooltipText(const gfx::Point& p, |
163 string16* tooltip) const OVERRIDE { | 163 string16* tooltip) const OVERRIDE { |
164 gfx::Point location(p); | 164 gfx::Point location(p); |
165 ConvertPointToScreen(this, &location); | 165 ConvertPointToScreen(this, &location); |
166 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_, | 166 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_, |
167 text(), profile_); | 167 text(), profile_); |
168 return !tooltip->empty(); | 168 return !tooltip->empty(); |
169 } | 169 } |
170 | 170 |
171 virtual bool IsTriggerableEvent(const views::Event& e) OVERRIDE { | 171 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE { |
172 return e.type() == ui::ET_GESTURE_TAP || | 172 return e.type() == ui::ET_GESTURE_TAP || |
173 e.type() == ui::ET_GESTURE_TAP_DOWN || | 173 e.type() == ui::ET_GESTURE_TAP_DOWN || |
174 event_utils::IsPossibleDispositionEvent(e); | 174 event_utils::IsPossibleDispositionEvent(e); |
175 } | 175 } |
176 | 176 |
177 virtual std::string GetClassName() const OVERRIDE { | 177 virtual std::string GetClassName() const OVERRIDE { |
178 return kViewClassName; | 178 return kViewClassName; |
179 } | 179 } |
180 | 180 |
181 private: | 181 private: |
(...skipping 29 matching lines...) Expand all Loading... |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 virtual bool GetTooltipText(const gfx::Point& p, | 214 virtual bool GetTooltipText(const gfx::Point& p, |
215 string16* tooltip) const OVERRIDE { | 215 string16* tooltip) const OVERRIDE { |
216 if (text_size_.width() > GetTextBounds().width()) | 216 if (text_size_.width() > GetTextBounds().width()) |
217 *tooltip = text_; | 217 *tooltip = text_; |
218 return !tooltip->empty(); | 218 return !tooltip->empty(); |
219 } | 219 } |
220 | 220 |
221 virtual bool IsTriggerableEvent(const views::Event& e) OVERRIDE { | 221 virtual bool IsTriggerableEvent(const ui::Event& e) OVERRIDE { |
222 // Left clicks and taps should show the menu contents and right clicks | 222 // Left clicks and taps should show the menu contents and right clicks |
223 // should show the context menu. They should not trigger the opening of | 223 // should show the context menu. They should not trigger the opening of |
224 // underlying urls. | 224 // underlying urls. |
225 if (e.type() == ui::ET_GESTURE_TAP || | 225 if (e.type() == ui::ET_GESTURE_TAP || |
226 (e.IsMouseEvent() && (e.flags() & | 226 (e.IsMouseEvent() && (e.flags() & |
227 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)))) | 227 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)))) |
228 return false; | 228 return false; |
229 | 229 |
230 if (e.IsMouseEvent()) | 230 if (e.IsMouseEvent()) |
231 return chrome::DispositionFromEventFlags(e.flags()) != CURRENT_TAB; | 231 return chrome::DispositionFromEventFlags(e.flags()) != CURRENT_TAB; |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 node = model_->bookmark_bar_node()->GetChild(button_index); | 1022 node = model_->bookmark_bar_node()->GetChild(button_index); |
1023 } | 1023 } |
1024 | 1024 |
1025 bookmark_menu_ = new BookmarkMenuController(browser_, | 1025 bookmark_menu_ = new BookmarkMenuController(browser_, |
1026 page_navigator_, GetWidget(), node, start_index); | 1026 page_navigator_, GetWidget(), node, start_index); |
1027 bookmark_menu_->set_observer(this); | 1027 bookmark_menu_->set_observer(this); |
1028 bookmark_menu_->RunMenuAt(this, false); | 1028 bookmark_menu_->RunMenuAt(this, false); |
1029 } | 1029 } |
1030 | 1030 |
1031 void BookmarkBarView::ButtonPressed(views::Button* sender, | 1031 void BookmarkBarView::ButtonPressed(views::Button* sender, |
1032 const views::Event& event) { | 1032 const ui::Event& event) { |
1033 const BookmarkNode* node; | 1033 const BookmarkNode* node; |
1034 if (sender->tag() == kOtherFolderButtonTag) { | 1034 if (sender->tag() == kOtherFolderButtonTag) { |
1035 node = model_->other_node(); | 1035 node = model_->other_node(); |
1036 } else { | 1036 } else { |
1037 int index = GetIndexOf(sender); | 1037 int index = GetIndexOf(sender); |
1038 DCHECK_NE(-1, index); | 1038 DCHECK_NE(-1, index); |
1039 node = model_->bookmark_bar_node()->GetChild(index); | 1039 node = model_->bookmark_bar_node()->GetChild(index); |
1040 } | 1040 } |
1041 DCHECK(page_navigator_); | 1041 DCHECK(page_navigator_); |
1042 | 1042 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 (1 - size_animation_->GetCurrentValue()))); | 1682 (1 - size_animation_->GetCurrentValue()))); |
1683 } else { | 1683 } else { |
1684 prefsize.set_height( | 1684 prefsize.set_height( |
1685 static_cast<int>( | 1685 static_cast<int>( |
1686 browser_defaults::kBookmarkBarHeight * | 1686 browser_defaults::kBookmarkBarHeight * |
1687 size_animation_->GetCurrentValue())); | 1687 size_animation_->GetCurrentValue())); |
1688 } | 1688 } |
1689 } | 1689 } |
1690 return prefsize; | 1690 return prefsize; |
1691 } | 1691 } |
OLD | NEW |