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

Side by Side Diff: ash/app_list/app_list_presenter_delegate.cc

Issue 2036353002: mash: Move ash/common/wm/shelf to ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 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
« no previous file with comments | « no previous file | ash/ash.gyp » ('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/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/common/shelf/shelf_types.h"
8 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
9 #include "ash/display/window_tree_host_manager.h" 10 #include "ash/display/window_tree_host_manager.h"
10 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
11 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
12 #include "ash/shelf/shelf.h" 13 #include "ash/shelf/shelf.h"
13 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/shell_delegate.h" 16 #include "ash/shell_delegate.h"
16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
17 #include "base/command_line.h" 18 #include "base/command_line.h"
(...skipping 21 matching lines...) Expand all
39 return Shelf::ForWindow(window)->SelectValueForShelfAlignment( 40 return Shelf::ForWindow(window)->SelectValueForShelfAlignment(
40 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, 41 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER,
41 views::BubbleBorder::RIGHT_CENTER); 42 views::BubbleBorder::RIGHT_CENTER);
42 } 43 }
43 44
44 // Using |button_bounds|, determine the anchor offset so that the bubble gets 45 // Using |button_bounds|, determine the anchor offset so that the bubble gets
45 // shown above the shelf (used for the alternate shelf theme). 46 // shown above the shelf (used for the alternate shelf theme).
46 gfx::Vector2d GetAnchorPositionOffsetToShelf(const gfx::Rect& button_bounds, 47 gfx::Vector2d GetAnchorPositionOffsetToShelf(const gfx::Rect& button_bounds,
47 views::Widget* widget) { 48 views::Widget* widget) {
48 DCHECK(Shell::HasInstance()); 49 DCHECK(Shell::HasInstance());
49 wm::ShelfAlignment shelf_alignment = 50 ShelfAlignment shelf_alignment =
50 Shelf::ForWindow(widget->GetNativeView()->GetRootWindow())->alignment(); 51 Shelf::ForWindow(widget->GetNativeView()->GetRootWindow())->alignment();
51 gfx::Point anchor(button_bounds.CenterPoint()); 52 gfx::Point anchor(button_bounds.CenterPoint());
52 switch (shelf_alignment) { 53 switch (shelf_alignment) {
53 case wm::SHELF_ALIGNMENT_BOTTOM: 54 case SHELF_ALIGNMENT_BOTTOM:
54 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: 55 case SHELF_ALIGNMENT_BOTTOM_LOCKED:
55 if (base::i18n::IsRTL()) { 56 if (base::i18n::IsRTL()) {
56 int screen_width = widget->GetWorkAreaBoundsInScreen().width(); 57 int screen_width = widget->GetWorkAreaBoundsInScreen().width();
57 return gfx::Vector2d( 58 return gfx::Vector2d(
58 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(), 59 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(),
59 0), 60 0),
60 0); 61 0);
61 } 62 }
62 return gfx::Vector2d( 63 return gfx::Vector2d(
63 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0); 64 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0);
64 case wm::SHELF_ALIGNMENT_LEFT: 65 case SHELF_ALIGNMENT_LEFT:
65 return gfx::Vector2d( 66 return gfx::Vector2d(
66 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 67 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
67 case wm::SHELF_ALIGNMENT_RIGHT: 68 case SHELF_ALIGNMENT_RIGHT:
68 return gfx::Vector2d( 69 return gfx::Vector2d(
69 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 70 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
70 } 71 }
71 NOTREACHED(); 72 NOTREACHED();
72 return gfx::Vector2d(); 73 return gfx::Vector2d();
73 } 74 }
74 75
75 // Gets the point at the center of the display that a particular view is on. 76 // Gets the point at the center of the display that a particular view is on.
76 // This calculation excludes the virtual keyboard area. If the height of the 77 // This calculation excludes the virtual keyboard area. If the height of the
77 // display area is less than |minimum_height|, its bottom will be extended to 78 // display area is less than |minimum_height|, its bottom will be extended to
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 336 }
336 337
337 //////////////////////////////////////////////////////////////////////////////// 338 ////////////////////////////////////////////////////////////////////////////////
338 // AppListPresenterDelegate, ShelfIconObserver implementation: 339 // AppListPresenterDelegate, ShelfIconObserver implementation:
339 340
340 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 341 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
341 UpdateBounds(); 342 UpdateBounds();
342 } 343 }
343 344
344 } // namespace ash 345 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698