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

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

Issue 14533006: Drag and drop between app list and launcher - First patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 AppListController::~AppListController() { 93 AppListController::~AppListController() {
94 // Ensures app list view goes before the controller since pagination model 94 // Ensures app list view goes before the controller since pagination model
95 // lives in the controller and app list view would access it on destruction. 95 // lives in the controller and app list view would access it on destruction.
96 if (view_ && view_->GetWidget()) 96 if (view_ && view_->GetWidget())
97 view_->GetWidget()->CloseNow(); 97 view_->GetWidget()->CloseNow();
98 98
99 Shell::GetInstance()->RemoveShellObserver(this); 99 Shell::GetInstance()->RemoveShellObserver(this);
100 pagination_model_->RemoveObserver(this); 100 pagination_model_->RemoveObserver(this);
101 } 101 }
102 102
103 void AppListController::SetVisible(bool visible, aura::Window* window) { 103 void AppListController::SetVisible(bool visible,
104 aura::Window* window) {
104 if (visible == is_visible_) 105 if (visible == is_visible_)
105 return; 106 return;
106 107
107 is_visible_ = visible; 108 is_visible_ = visible;
108 109
109 // App list needs to know the new shelf layout in order to calculate its 110 // App list needs to know the new shelf layout in order to calculate its
110 // UI layout when AppListView visibility changes. 111 // UI layout when AppListView visibility changes.
111 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager()-> 112 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager()->
112 UpdateAutoHideState(); 113 UpdateAutoHideState();
113 114
(...skipping 18 matching lines...) Expand all
132 } 133 }
133 134
134 bool AppListController::IsVisible() const { 135 bool AppListController::IsVisible() const {
135 return view_ && view_->GetWidget()->IsVisible(); 136 return view_ && view_->GetWidget()->IsVisible();
136 } 137 }
137 138
138 aura::Window* AppListController::GetWindow() { 139 aura::Window* AppListController::GetWindow() {
139 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL; 140 return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : NULL;
140 } 141 }
141 142
143 void AppListController::SetAppListDnDHost(
144 app_list::ApplicationDnDHost* dnd_host) {
145 if (view_ && is_visible_)
146 view_->SetAppListDnDHost(dnd_host);
147 }
148
142 //////////////////////////////////////////////////////////////////////////////// 149 ////////////////////////////////////////////////////////////////////////////////
143 // AppListController, private: 150 // AppListController, private:
144 151
145 void AppListController::SetView(app_list::AppListView* view) { 152 void AppListController::SetView(app_list::AppListView* view) {
146 DCHECK(view_ == NULL); 153 DCHECK(view_ == NULL);
147 DCHECK(is_visible_); 154 DCHECK(is_visible_);
148 155
149 view_ = view; 156 view_ = view;
150 views::Widget* widget = view_->GetWidget(); 157 views::Widget* widget = view_->GetWidget();
151 widget->AddObserver(this); 158 widget->AddObserver(this);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 should_snap_back_ = false; 347 should_snap_back_ = false;
341 ui::ScopedLayerAnimationSettings animation(widget_animator); 348 ui::ScopedLayerAnimationSettings animation(widget_animator);
342 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 349 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
343 app_list::kOverscrollPageTransitionDurationMs)); 350 app_list::kOverscrollPageTransitionDurationMs));
344 widget->SetBounds(view_bounds_); 351 widget->SetBounds(view_bounds_);
345 } 352 }
346 } 353 }
347 354
348 } // namespace internal 355 } // namespace internal
349 } // namespace ash 356 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698