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

Side by Side Diff: ash/shelf/shelf_button.cc

Issue 2975063003: [Merge M60] Fix shelf dragging context in case Context Menu is shown. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « no previous file | ash/shelf/shelf_view.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 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 "ash/shelf/shelf_button.h" 5 #include "ash/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/shelf/ink_drop_button_listener.h" 10 #include "ash/shelf/ink_drop_button_listener.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 bool destroyed = false; 309 bool destroyed = false;
310 destroyed_flag_ = &destroyed; 310 destroyed_flag_ = &destroyed;
311 311
312 CustomButton::ShowContextMenu(p, source_type); 312 CustomButton::ShowContextMenu(p, source_type);
313 313
314 if (!destroyed) { 314 if (!destroyed) {
315 destroyed_flag_ = nullptr; 315 destroyed_flag_ = nullptr;
316 // The menu will not propagate mouse events while its shown. To address, 316 // The menu will not propagate mouse events while its shown. To address,
317 // the hover state gets cleared once the menu was shown (and this was not 317 // the hover state gets cleared once the menu was shown (and this was not
318 // destroyed). 318 // destroyed). In case context menu is shown target view does not receive
319 ClearState(STATE_HOVERED); 319 // OnMouseReleased events and we need to cancel capture manually.
320 if (shelf_view_->drag_view() == this)
321 OnMouseCaptureLost();
322 else
323 ClearState(STATE_HOVERED);
320 } 324 }
321 } 325 }
322 326
323 const char* ShelfButton::GetClassName() const { 327 const char* ShelfButton::GetClassName() const {
324 return kViewClassName; 328 return kViewClassName;
325 } 329 }
326 330
327 bool ShelfButton::OnMousePressed(const ui::MouseEvent& event) { 331 bool ShelfButton::OnMousePressed(const ui::MouseEvent& event) {
328 CustomButton::OnMousePressed(event); 332 CustomButton::OnMousePressed(event);
329 shelf_view_->PointerPressedOnButton(this, ShelfView::MOUSE, event); 333 shelf_view_->PointerPressedOnButton(this, ShelfView::MOUSE, event);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 icon_view_->SetHorizontalAlignment(is_horizontal_shelf 509 icon_view_->SetHorizontalAlignment(is_horizontal_shelf
506 ? views::ImageView::CENTER 510 ? views::ImageView::CENTER
507 : views::ImageView::LEADING); 511 : views::ImageView::LEADING);
508 icon_view_->SetVerticalAlignment(is_horizontal_shelf 512 icon_view_->SetVerticalAlignment(is_horizontal_shelf
509 ? views::ImageView::LEADING 513 ? views::ImageView::LEADING
510 : views::ImageView::CENTER); 514 : views::ImageView::CENTER);
511 SchedulePaint(); 515 SchedulePaint();
512 } 516 }
513 517
514 } // namespace ash 518 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698