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

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 11434099: Use the correct launcher assets for shelf alignment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/wm/shelf_layout_manager.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 (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/wm/app_list_controller.h" 5 #include "ash/wm/app_list_controller.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 27 matching lines...) Expand all
38 const int kMaxOverScrollShift = 48; 38 const int kMaxOverScrollShift = 48;
39 39
40 ui::Layer* GetLayer(views::Widget* widget) { 40 ui::Layer* GetLayer(views::Widget* widget) {
41 return widget->GetNativeView()->layer(); 41 return widget->GetNativeView()->layer();
42 } 42 }
43 43
44 // Gets arrow location based on shelf alignment. 44 // Gets arrow location based on shelf alignment.
45 views::BubbleBorder::ArrowLocation GetBubbleArrowLocation( 45 views::BubbleBorder::ArrowLocation GetBubbleArrowLocation(
46 aura::Window* window) { 46 aura::Window* window) {
47 DCHECK(Shell::HasInstance()); 47 DCHECK(Shell::HasInstance());
48 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( 48 return ShelfLayoutManager::ForLauncher(window)->
49 window->GetRootWindow()); 49 SelectValueForShelfAlignment(
50 switch (shelf_alignment) { 50 views::BubbleBorder::BOTTOM_CENTER,
51 case ash::SHELF_ALIGNMENT_BOTTOM: 51 views::BubbleBorder::LEFT_CENTER,
52 return views::BubbleBorder::BOTTOM_CENTER; 52 views::BubbleBorder::RIGHT_CENTER);
53 case ash::SHELF_ALIGNMENT_LEFT:
54 return views::BubbleBorder::LEFT_CENTER;
55 case ash::SHELF_ALIGNMENT_RIGHT:
56 return views::BubbleBorder::RIGHT_CENTER;
57 default:
58 NOTREACHED() << "Unknown shelf alignment " << shelf_alignment;
59 return views::BubbleBorder::BOTTOM_CENTER;
60 }
61 } 53 }
62 54
63 // Offset given |rect| towards shelf. 55 // Offset given |rect| towards shelf.
64 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) { 56 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) {
65 DCHECK(Shell::HasInstance()); 57 DCHECK(Shell::HasInstance());
66 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( 58 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment(
67 widget->GetNativeView()->GetRootWindow()); 59 widget->GetNativeView()->GetRootWindow());
68 gfx::Rect offseted(rect); 60 gfx::Rect offseted(rect);
69 switch (shelf_alignment) { 61 switch (shelf_alignment) {
70 case SHELF_ALIGNMENT_BOTTOM: 62 case SHELF_ALIGNMENT_BOTTOM:
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 should_snap_back_ = false; 347 should_snap_back_ = false;
356 ui::ScopedLayerAnimationSettings animation(widget_animator); 348 ui::ScopedLayerAnimationSettings animation(widget_animator);
357 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 349 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
358 app_list::kOverscrollPageTransitionDurationMs)); 350 app_list::kOverscrollPageTransitionDurationMs));
359 widget->SetBounds(view_bounds_); 351 widget->SetBounds(view_bounds_);
360 } 352 }
361 } 353 }
362 354
363 } // namespace internal 355 } // namespace internal
364 } // namespace ash 356 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/wm/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698