OLD | NEW |
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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/common/shelf/app_list_button.h" | 8 #include "ash/common/shelf/app_list_button.h" |
9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
64 // AppListPresenterDelegate, public: | 64 // AppListPresenterDelegate, public: |
65 | 65 |
66 AppListPresenterDelegate::AppListPresenterDelegate( | 66 AppListPresenterDelegate::AppListPresenterDelegate( |
67 app_list::AppListPresenterImpl* presenter, | 67 app_list::AppListPresenterImpl* presenter, |
68 app_list::AppListViewDelegateFactory* view_delegate_factory) | 68 app_list::AppListViewDelegateFactory* view_delegate_factory) |
69 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { | 69 : presenter_(presenter), view_delegate_factory_(view_delegate_factory) { |
70 WmShell::Get()->AddShellObserver(this); | 70 Shell::GetInstance()->AddShellObserver(this); |
71 } | 71 } |
72 | 72 |
73 AppListPresenterDelegate::~AppListPresenterDelegate() { | 73 AppListPresenterDelegate::~AppListPresenterDelegate() { |
74 DCHECK(view_); | 74 DCHECK(view_); |
75 keyboard::KeyboardController* keyboard_controller = | 75 keyboard::KeyboardController* keyboard_controller = |
76 keyboard::KeyboardController::GetInstance(); | 76 keyboard::KeyboardController::GetInstance(); |
77 if (keyboard_controller) | 77 if (keyboard_controller) |
78 keyboard_controller->RemoveObserver(this); | 78 keyboard_controller->RemoveObserver(this); |
79 Shell::GetInstance()->RemovePreTargetHandler(this); | 79 Shell::GetInstance()->RemovePreTargetHandler(this); |
80 WmWindow* window = WmWindow::Get(view_->GetWidget()->GetNativeWindow()); | 80 WmWindow* window = WmWindow::Get(view_->GetWidget()->GetNativeWindow()); |
81 window->GetRootWindowController()->GetShelf()->RemoveObserver(this); | 81 window->GetRootWindowController()->GetShelf()->RemoveObserver(this); |
82 WmShell::Get()->RemoveShellObserver(this); | 82 Shell::GetInstance()->RemoveShellObserver(this); |
83 } | 83 } |
84 | 84 |
85 app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() { | 85 app_list::AppListViewDelegate* AppListPresenterDelegate::GetViewDelegate() { |
86 return view_delegate_factory_->GetDelegate(); | 86 return view_delegate_factory_->GetDelegate(); |
87 } | 87 } |
88 | 88 |
89 void AppListPresenterDelegate::Init(app_list::AppListView* view, | 89 void AppListPresenterDelegate::Init(app_list::AppListView* view, |
90 int64_t display_id, | 90 int64_t display_id, |
91 int current_apps_page) { | 91 int current_apps_page) { |
92 // App list needs to know the new shelf layout in order to calculate its | 92 // App list needs to know the new shelf layout in order to calculate its |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 240 } |
241 | 241 |
242 //////////////////////////////////////////////////////////////////////////////// | 242 //////////////////////////////////////////////////////////////////////////////// |
243 // AppListPresenterDelegate, WmShelfObserver implementation: | 243 // AppListPresenterDelegate, WmShelfObserver implementation: |
244 | 244 |
245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { |
246 UpdateBounds(); | 246 UpdateBounds(); |
247 } | 247 } |
248 | 248 |
249 } // namespace ash | 249 } // namespace ash |
OLD | NEW |