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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 247193002: Remove touch layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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 "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 bool ToolbarButton::IsMenuShowing() const { 45 bool ToolbarButton::IsMenuShowing() const {
46 return menu_showing_; 46 return menu_showing_;
47 } 47 }
48 48
49 gfx::Size ToolbarButton::GetPreferredSize() { 49 gfx::Size ToolbarButton::GetPreferredSize() {
50 gfx::Size size(image()->GetPreferredSize()); 50 gfx::Size size(image()->GetPreferredSize());
51 gfx::Size label_size = label()->GetPreferredSize(); 51 gfx::Size label_size = label()->GetPreferredSize();
52 if (label_size.width() > 0) 52 if (label_size.width() > 0)
53 size.Enlarge(label_size.width() + LocationBarView::GetItemPadding(), 0); 53 size.Enlarge(label_size.width() + LocationBarView::kItemPadding, 0);
54 return size; 54 return size;
55 } 55 }
56 56
57 bool ToolbarButton::OnMousePressed(const ui::MouseEvent& event) { 57 bool ToolbarButton::OnMousePressed(const ui::MouseEvent& event) {
58 if (enabled() && ShouldShowMenu() && 58 if (enabled() && ShouldShowMenu() &&
59 IsTriggerableEvent(event) && HitTestPoint(event.location())) { 59 IsTriggerableEvent(event) && HitTestPoint(event.location())) {
60 // Store the y pos of the mouse coordinates so we can use them later to 60 // Store the y pos of the mouse coordinates so we can use them later to
61 // determine if the user dragged the mouse down (which should pop up the 61 // determine if the user dragged the mouse down (which should pop up the
62 // drag down menu immediately, instead of waiting for the timer) 62 // drag down menu immediately, instead of waiting for the timer)
63 y_position_on_lbuttondown_ = event.y(); 63 y_position_on_lbuttondown_ = event.y();
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // Need to explicitly clear mouse handler so that events get sent 225 // Need to explicitly clear mouse handler so that events get sent
226 // properly after the menu finishes running. If we don't do this, then 226 // properly after the menu finishes running. If we don't do this, then
227 // the first click to other parts of the UI is eaten. 227 // the first click to other parts of the UI is eaten.
228 SetMouseHandler(NULL); 228 SetMouseHandler(NULL);
229 229
230 // Set the state back to normal after the drop down menu is closed. 230 // Set the state back to normal after the drop down menu is closed.
231 if (state_ != STATE_DISABLED) 231 if (state_ != STATE_DISABLED)
232 SetState(STATE_NORMAL); 232 SetState(STATE_NORMAL);
233 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698