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

Side by Side Diff: ash/launcher/launcher.cc

Issue 71653003: ash: Rename LauncherModel to ShelfModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chrome changes Created 7 years, 1 month 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/launcher/launcher.h ('k') | ash/launcher/launcher_item_delegate_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/launcher/launcher.h" 5 #include "ash/launcher/launcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ash/focus_cycler.h" 10 #include "ash/focus_cycler.h"
11 #include "ash/launcher/launcher_delegate.h" 11 #include "ash/launcher/launcher_delegate.h"
12 #include "ash/launcher/launcher_item_delegate.h" 12 #include "ash/launcher/launcher_item_delegate.h"
13 #include "ash/launcher/launcher_item_delegate_manager.h" 13 #include "ash/launcher/launcher_item_delegate_manager.h"
14 #include "ash/launcher/launcher_model.h"
15 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
16 #include "ash/screen_ash.h" 15 #include "ash/screen_ash.h"
17 #include "ash/shelf/shelf_layout_manager.h" 16 #include "ash/shelf/shelf_layout_manager.h"
17 #include "ash/shelf/shelf_model.h"
18 #include "ash/shelf/shelf_navigator.h" 18 #include "ash/shelf/shelf_navigator.h"
19 #include "ash/shelf/shelf_view.h" 19 #include "ash/shelf/shelf_view.h"
20 #include "ash/shelf/shelf_widget.h" 20 #include "ash/shelf/shelf_widget.h"
21 #include "ash/shell.h" 21 #include "ash/shell.h"
22 #include "ash/shell_delegate.h" 22 #include "ash/shell_delegate.h"
23 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
24 #include "ash/wm/window_properties.h" 24 #include "ash/wm/window_properties.h"
25 #include "grit/ash_resources.h" 25 #include "grit/ash_resources.h"
26 #include "ui/aura/client/activation_client.h" 26 #include "ui/aura/client/activation_client.h"
27 #include "ui/aura/root_window.h" 27 #include "ui/aura/root_window.h"
28 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
29 #include "ui/aura/window_observer.h" 29 #include "ui/aura/window_observer.h"
30 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
32 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
33 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
34 #include "ui/gfx/image/image_skia_operations.h" 34 #include "ui/gfx/image/image_skia_operations.h"
35 #include "ui/gfx/skbitmap_operations.h" 35 #include "ui/gfx/skbitmap_operations.h"
36 #include "ui/views/accessible_pane_view.h" 36 #include "ui/views/accessible_pane_view.h"
37 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
38 #include "ui/views/widget/widget_delegate.h" 38 #include "ui/views/widget/widget_delegate.h"
39 39
40 namespace ash { 40 namespace ash {
41 41
42 const char Launcher::kNativeViewName[] = "ShelfView"; 42 const char Launcher::kNativeViewName[] = "ShelfView";
43 43
44 Launcher::Launcher(LauncherModel* launcher_model, 44 Launcher::Launcher(ShelfModel* shelf_model,
45 LauncherDelegate* launcher_delegate, 45 LauncherDelegate* launcher_delegate,
46 ShelfWidget* shelf_widget) 46 ShelfWidget* shelf_widget)
47 : shelf_view_(NULL), 47 : shelf_view_(NULL),
48 alignment_(shelf_widget->GetAlignment()), 48 alignment_(shelf_widget->GetAlignment()),
49 delegate_(launcher_delegate), 49 delegate_(launcher_delegate),
50 shelf_widget_(shelf_widget) { 50 shelf_widget_(shelf_widget) {
51 shelf_view_ = new internal::ShelfView( 51 shelf_view_ = new internal::ShelfView(
52 launcher_model, delegate_, shelf_widget_->shelf_layout_manager()); 52 shelf_model, delegate_, shelf_widget_->shelf_layout_manager());
53 shelf_view_->Init(); 53 shelf_view_->Init();
54 shelf_widget_->GetContentsView()->AddChildView(shelf_view_); 54 shelf_widget_->GetContentsView()->AddChildView(shelf_view_);
55 shelf_widget_->GetNativeView()->SetName(kNativeViewName); 55 shelf_widget_->GetNativeView()->SetName(kNativeViewName);
56 delegate_->OnLauncherCreated(this); 56 delegate_->OnLauncherCreated(this);
57 } 57 }
58 58
59 Launcher::~Launcher() { 59 Launcher::~Launcher() {
60 delegate_->OnLauncherDestroyed(this); 60 delegate_->OnLauncherDestroyed(this);
61 } 61 }
62 62
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 void Launcher::SchedulePaint() { 148 void Launcher::SchedulePaint() {
149 shelf_view_->SchedulePaintForAllButtons(); 149 shelf_view_->SchedulePaintForAllButtons();
150 } 150 }
151 151
152 views::View* Launcher::GetAppListButtonView() const { 152 views::View* Launcher::GetAppListButtonView() const {
153 return shelf_view_->GetAppListButtonView(); 153 return shelf_view_->GetAppListButtonView();
154 } 154 }
155 155
156 void Launcher::LaunchAppIndexAt(int item_index) { 156 void Launcher::LaunchAppIndexAt(int item_index) {
157 LauncherModel* launcher_model = shelf_view_->model(); 157 ShelfModel* shelf_model = shelf_view_->model();
158 const LauncherItems& items = launcher_model->items(); 158 const LauncherItems& items = shelf_model->items();
159 int item_count = launcher_model->item_count(); 159 int item_count = shelf_model->item_count();
160 int indexes_left = item_index >= 0 ? item_index : item_count; 160 int indexes_left = item_index >= 0 ? item_index : item_count;
161 int found_index = -1; 161 int found_index = -1;
162 162
163 // Iterating until we have hit the index we are interested in which 163 // Iterating until we have hit the index we are interested in which
164 // is true once indexes_left becomes negative. 164 // is true once indexes_left becomes negative.
165 for (int i = 0; i < item_count && indexes_left >= 0; i++) { 165 for (int i = 0; i < item_count && indexes_left >= 0; i++) {
166 if (items[i].type != TYPE_APP_LIST) { 166 if (items[i].type != TYPE_APP_LIST) {
167 found_index = i; 167 found_index = i;
168 indexes_left--; 168 indexes_left--;
169 } 169 }
(...skipping 18 matching lines...) Expand all
188 188
189 gfx::Rect Launcher::GetVisibleItemsBoundsInScreen() const { 189 gfx::Rect Launcher::GetVisibleItemsBoundsInScreen() const {
190 return shelf_view_->GetVisibleItemsBoundsInScreen(); 190 return shelf_view_->GetVisibleItemsBoundsInScreen();
191 } 191 }
192 192
193 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() { 193 app_list::ApplicationDragAndDropHost* Launcher::GetDragAndDropHostForAppList() {
194 return shelf_view_; 194 return shelf_view_;
195 } 195 }
196 196
197 } // namespace ash 197 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_item_delegate_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698