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

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

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: merge 2 trunk Created 4 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/ash.gyp » ('j') | ash/shelf/shelf.cc » ('J')
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/app_list/app_list_view_delegate_factory.h" 7 #include "ash/app_list/app_list_view_delegate_factory.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return Shelf::ForWindow(window)->SelectValueForShelfAlignment( 44 return Shelf::ForWindow(window)->SelectValueForShelfAlignment(
45 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, 45 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER,
46 views::BubbleBorder::RIGHT_CENTER); 46 views::BubbleBorder::RIGHT_CENTER);
47 } 47 }
48 48
49 // Using |button_bounds|, determine the anchor offset so that the bubble gets 49 // Using |button_bounds|, determine the anchor offset so that the bubble gets
50 // shown above the shelf (used for the alternate shelf theme). 50 // shown above the shelf (used for the alternate shelf theme).
51 gfx::Vector2d GetAnchorPositionOffsetToShelf(const gfx::Rect& button_bounds, 51 gfx::Vector2d GetAnchorPositionOffsetToShelf(const gfx::Rect& button_bounds,
52 views::Widget* widget) { 52 views::Widget* widget) {
53 DCHECK(Shell::HasInstance()); 53 DCHECK(Shell::HasInstance());
54 ShelfAlignment shelf_alignment = 54 wm::ShelfAlignment shelf_alignment =
55 Shelf::ForWindow(widget->GetNativeView()->GetRootWindow())->alignment(); 55 Shelf::ForWindow(widget->GetNativeView()->GetRootWindow())->alignment();
56 gfx::Point anchor(button_bounds.CenterPoint()); 56 gfx::Point anchor(button_bounds.CenterPoint());
57 switch (shelf_alignment) { 57 switch (shelf_alignment) {
58 case SHELF_ALIGNMENT_BOTTOM: 58 case wm::SHELF_ALIGNMENT_BOTTOM:
59 case SHELF_ALIGNMENT_BOTTOM_LOCKED: 59 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED:
60 if (base::i18n::IsRTL()) { 60 if (base::i18n::IsRTL()) {
61 int screen_width = widget->GetWorkAreaBoundsInScreen().width(); 61 int screen_width = widget->GetWorkAreaBoundsInScreen().width();
62 return gfx::Vector2d( 62 return gfx::Vector2d(
63 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(), 63 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(),
64 0), 64 0),
65 0); 65 0);
66 } 66 }
67 return gfx::Vector2d( 67 return gfx::Vector2d(
68 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0); 68 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0);
69 case SHELF_ALIGNMENT_LEFT: 69 case wm::SHELF_ALIGNMENT_LEFT:
70 return gfx::Vector2d( 70 return gfx::Vector2d(
71 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 71 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
72 case SHELF_ALIGNMENT_RIGHT: 72 case wm::SHELF_ALIGNMENT_RIGHT:
73 return gfx::Vector2d( 73 return gfx::Vector2d(
74 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 74 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
75 } 75 }
76 NOTREACHED(); 76 NOTREACHED();
77 return gfx::Vector2d(); 77 return gfx::Vector2d();
78 } 78 }
79 79
80 // Gets the point at the center of the display that a particular view is on. 80 // Gets the point at the center of the display that a particular view is on.
81 // This calculation excludes the virtual keyboard area. If the height of the 81 // This calculation excludes the virtual keyboard area. If the height of the
82 // display area is less than |minimum_height|, its bottom will be extended to 82 // display area is less than |minimum_height|, its bottom will be extended to
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 //////////////////////////////////////////////////////////////////////////////// 341 ////////////////////////////////////////////////////////////////////////////////
342 // AppListPresenterDelegate, ShelfIconObserver implementation: 342 // AppListPresenterDelegate, ShelfIconObserver implementation:
343 343
344 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 344 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
345 UpdateBounds(); 345 UpdateBounds();
346 } 346 }
347 347
348 } // namespace ash 348 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/shelf/shelf.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698