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

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

Issue 1534303002: CustomButton cleanup: make protected members private, create accessors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert a change Created 5 years 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
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 "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 show_menu_factory_.InvalidateWeakPtrs(); 147 show_menu_factory_.InvalidateWeakPtrs();
148 } 148 }
149 149
150 void ToolbarButton::OnMouseCaptureLost() { 150 void ToolbarButton::OnMouseCaptureLost() {
151 } 151 }
152 152
153 void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) { 153 void ToolbarButton::OnMouseExited(const ui::MouseEvent& event) {
154 // Starting a drag results in a MouseExited, we need to ignore it. 154 // Starting a drag results in a MouseExited, we need to ignore it.
155 // A right click release triggers an exit event. We want to 155 // A right click release triggers an exit event. We want to
156 // remain in a PUSHED state until the drop down menu closes. 156 // remain in a PUSHED state until the drop down menu closes.
157 if (state_ != STATE_DISABLED && !InDrag() && state_ != STATE_PRESSED) 157 if (state() != STATE_DISABLED && !InDrag() && state() != STATE_PRESSED)
158 SetState(STATE_NORMAL); 158 SetState(STATE_NORMAL);
159 } 159 }
160 160
161 void ToolbarButton::OnGestureEvent(ui::GestureEvent* event) { 161 void ToolbarButton::OnGestureEvent(ui::GestureEvent* event) {
162 if (menu_showing_) { 162 if (menu_showing_) {
163 // While dropdown menu is showing the button should not handle gestures. 163 // While dropdown menu is showing the button should not handle gestures.
164 event->StopPropagation(); 164 event->StopPropagation();
165 return; 165 return;
166 } 166 }
167 167
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 views::InkDropState::DEACTIVATED); 339 views::InkDropState::DEACTIVATED);
340 340
341 menu_showing_ = false; 341 menu_showing_ = false;
342 342
343 // Need to explicitly clear mouse handler so that events get sent 343 // Need to explicitly clear mouse handler so that events get sent
344 // properly after the menu finishes running. If we don't do this, then 344 // properly after the menu finishes running. If we don't do this, then
345 // the first click to other parts of the UI is eaten. 345 // the first click to other parts of the UI is eaten.
346 SetMouseHandler(nullptr); 346 SetMouseHandler(nullptr);
347 347
348 // Set the state back to normal after the drop down menu is closed. 348 // Set the state back to normal after the drop down menu is closed.
349 if (state_ != STATE_DISABLED) 349 if (state() != STATE_DISABLED)
350 SetState(STATE_NORMAL); 350 SetState(STATE_NORMAL);
351 } 351 }
352 352
353 const char* ToolbarButton::GetClassName() const { 353 const char* ToolbarButton::GetClassName() const {
354 return "ToolbarButton"; 354 return "ToolbarButton";
355 } 355 }
356 356
357 gfx::Point ToolbarButton::CalculateInkDropCenter() const { 357 gfx::Point ToolbarButton::CalculateInkDropCenter() const {
358 return GetLocalBounds().CenterPoint(); 358 return GetLocalBounds().CenterPoint();
359 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698