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

Side by Side Diff: ash/common/shelf/shelf_view.cc

Issue 2807473003: Shelf: Hide overflow bubble when app launched from overflow. (Closed)
Patch Set: Fixed patch set 3 errors. Created 3 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
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('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 "ash/common/shelf/shelf_view.h" 5 #include "ash/common/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender, 431 shelf_button_pressed_metric_tracker_.ButtonPressed(event, sender,
432 SHELF_ACTION_NONE); 432 SHELF_ACTION_NONE);
433 return; 433 return;
434 } 434 }
435 435
436 // None of the checks in ShouldEventActivateButton() affects overflow button. 436 // None of the checks in ShouldEventActivateButton() affects overflow button.
437 // So, it is safe to be checked after handling overflow button. 437 // So, it is safe to be checked after handling overflow button.
438 if (!ShouldEventActivateButton(sender, event)) 438 if (!ShouldEventActivateButton(sender, event))
439 return; 439 return;
440 440
441 // If this is the overflow shelf, |main_shelf_| will not be null. When an item
442 // is pressed on the overflow shelf, we want to hide the overflow bubble,
443 // which is associated with the main shelf. Button presses on the main shelf
444 // cause the overflow bubble to close itself via PointerWatcher functionality.
445 if (main_shelf_ && main_shelf_->IsShowingOverflowBubble())
446 main_shelf_->ToggleOverflowBubble();
447
441 // Record the index for the last pressed shelf item. 448 // Record the index for the last pressed shelf item.
442 last_pressed_index_ = view_model_->GetIndexOfView(sender); 449 last_pressed_index_ = view_model_->GetIndexOfView(sender);
443 DCHECK_LT(-1, last_pressed_index_); 450 DCHECK_LT(-1, last_pressed_index_);
444 451
445 // Place new windows on the same display as the button. 452 // Place new windows on the same display as the button.
446 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow()); 453 WmWindow* window = WmWindow::Get(sender->GetWidget()->GetNativeWindow());
447 scoped_root_window_for_new_windows_.reset( 454 scoped_root_window_for_new_windows_.reset(
448 new ScopedRootWindowForNewWindows(window->GetRootWindow())); 455 new ScopedRootWindowForNewWindows(window->GetRootWindow()));
449 456
450 // Slow down activation animations if shift key is pressed. 457 // Slow down activation animations if shift key is pressed.
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 1764
1758 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { 1765 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const {
1759 const gfx::Rect bounds = GetBoundsInScreen(); 1766 const gfx::Rect bounds = GetBoundsInScreen();
1760 int distance = wm_shelf_->SelectValueForShelfAlignment( 1767 int distance = wm_shelf_->SelectValueForShelfAlignment(
1761 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), 1768 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(),
1762 bounds.x() - coordinate.x()); 1769 bounds.x() - coordinate.x());
1763 return distance > 0 ? distance : 0; 1770 return distance > 0 ? distance : 0;
1764 } 1771 }
1765 1772
1766 } // namespace ash 1773 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698