Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 10546104: Make IsTriggerableEvent take Event objects and use it to verify whether tap events should trigger. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass Event to ShouldEnterPushedState. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 virtual bool GetTooltipText(const gfx::Point& p, 157 virtual bool GetTooltipText(const gfx::Point& p,
158 string16* tooltip) const OVERRIDE { 158 string16* tooltip) const OVERRIDE {
159 gfx::Point location(p); 159 gfx::Point location(p);
160 ConvertPointToScreen(this, &location); 160 ConvertPointToScreen(this, &location);
161 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_, 161 *tooltip = BookmarkBarView::CreateToolTipForURLAndTitle(location, url_,
162 text(), profile_); 162 text(), profile_);
163 return !tooltip->empty(); 163 return !tooltip->empty();
164 } 164 }
165 165
166 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE { 166 virtual bool IsTriggerableEvent(const views::Event& e) OVERRIDE {
167 return event_utils::IsPossibleDispositionEvent(e); 167 return e.type() == ui::ET_GESTURE_TAP ||
168 e.type() == ui::ET_GESTURE_TAP_DOWN ||
169 event_utils::IsPossibleDispositionEvent(e);
168 } 170 }
169 171
170 virtual std::string GetClassName() const OVERRIDE { 172 virtual std::string GetClassName() const OVERRIDE {
171 return kViewClassName; 173 return kViewClassName;
172 } 174 }
173 175
174 private: 176 private:
175 const GURL& url_; 177 const GURL& url_;
176 Profile* profile_; 178 Profile* profile_;
177 scoped_ptr<ui::SlideAnimation> show_animation_; 179 scoped_ptr<ui::SlideAnimation> show_animation_;
(...skipping 26 matching lines...) Expand all
204 } 206 }
205 } 207 }
206 208
207 virtual bool GetTooltipText(const gfx::Point& p, 209 virtual bool GetTooltipText(const gfx::Point& p,
208 string16* tooltip) const OVERRIDE { 210 string16* tooltip) const OVERRIDE {
209 if (text_size_.width() > GetTextBounds().width()) 211 if (text_size_.width() > GetTextBounds().width())
210 *tooltip = text_; 212 *tooltip = text_;
211 return !tooltip->empty(); 213 return !tooltip->empty();
212 } 214 }
213 215
214 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE { 216 virtual bool IsTriggerableEvent(const views::Event& e) OVERRIDE {
215 // Left clicks should show the menu contents and right clicks should show 217 // Left clicks and taps should show the menu contents and right clicks
216 // the context menu. They should not trigger the opening of underlying urls. 218 // should show the context menu. They should not trigger the opening of
217 if (e.flags() == ui::EF_LEFT_MOUSE_BUTTON || 219 // underlying urls.
218 e.flags() == ui::EF_RIGHT_MOUSE_BUTTON) 220 if (e.type() == ui::ET_GESTURE_TAP ||
221 (e.IsMouseEvent() && (e.flags() &
222 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON))))
219 return false; 223 return false;
220 224
221 return browser::DispositionFromEventFlags(e.flags()) != CURRENT_TAB; 225 if (e.IsMouseEvent())
226 return browser::DispositionFromEventFlags(e.flags()) != CURRENT_TAB;
227 return false;
222 } 228 }
223 229
224 virtual void OnPaint(gfx::Canvas* canvas) { 230 virtual void OnPaint(gfx::Canvas* canvas) {
225 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL); 231 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL);
226 } 232 }
227 233
228 private: 234 private:
229 scoped_ptr<ui::SlideAnimation> show_animation_; 235 scoped_ptr<ui::SlideAnimation> show_animation_;
230 236
231 DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton); 237 DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton);
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 (1 - size_animation_->GetCurrentValue()))); 1675 (1 - size_animation_->GetCurrentValue())));
1670 } else { 1676 } else {
1671 prefsize.set_height( 1677 prefsize.set_height(
1672 static_cast<int>( 1678 static_cast<int>(
1673 browser_defaults::kBookmarkBarHeight * 1679 browser_defaults::kBookmarkBarHeight *
1674 size_animation_->GetCurrentValue())); 1680 size_animation_->GetCurrentValue()));
1675 } 1681 }
1676 } 1682 }
1677 return prefsize; 1683 return prefsize;
1678 } 1684 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698