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 "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 : delegate_(delegate), | 195 : delegate_(delegate), |
196 app_list_main_view_(nullptr), | 196 app_list_main_view_(nullptr), |
197 speech_view_(nullptr), | 197 speech_view_(nullptr), |
198 search_box_focus_host_(nullptr), | 198 search_box_focus_host_(nullptr), |
199 search_box_widget_(nullptr), | 199 search_box_widget_(nullptr), |
200 search_box_view_(nullptr), | 200 search_box_view_(nullptr), |
201 overlay_view_(nullptr), | 201 overlay_view_(nullptr), |
202 animation_observer_(new HideViewAnimationObserver()) { | 202 animation_observer_(new HideViewAnimationObserver()) { |
203 CHECK(delegate); | 203 CHECK(delegate); |
204 | 204 |
205 delegate_->AddObserver(this); | |
206 delegate_->GetSpeechUI()->AddObserver(this); | 205 delegate_->GetSpeechUI()->AddObserver(this); |
207 } | 206 } |
208 | 207 |
209 AppListView::~AppListView() { | 208 AppListView::~AppListView() { |
210 delegate_->GetSpeechUI()->RemoveObserver(this); | 209 delegate_->GetSpeechUI()->RemoveObserver(this); |
211 delegate_->RemoveObserver(this); | |
212 animation_observer_.reset(); | 210 animation_observer_.reset(); |
213 // Remove child views first to ensure no remaining dependencies on delegate_. | 211 // Remove child views first to ensure no remaining dependencies on delegate_. |
214 RemoveAllChildViews(true); | 212 RemoveAllChildViews(true); |
215 } | 213 } |
216 | 214 |
217 void AppListView::InitAsBubbleAtFixedLocation( | 215 void AppListView::InitAsBubbleAtFixedLocation( |
218 gfx::NativeView parent, | 216 gfx::NativeView parent, |
219 int initial_apps_page, | 217 int initial_apps_page, |
220 const gfx::Point& anchor_point_in_screen, | 218 const gfx::Point& anchor_point_in_screen, |
221 views::BubbleBorder::Arrow arrow, | 219 views::BubbleBorder::Arrow arrow, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (contents_view->custom_page_view() && | 339 if (contents_view->custom_page_view() && |
342 contents_view->GetActiveState() == AppListModel::STATE_START) | 340 contents_view->GetActiveState() == AppListModel::STATE_START) |
343 return !contents_view->custom_page_view() | 341 return !contents_view->custom_page_view() |
344 ->GetCollapsedLauncherPageBounds() | 342 ->GetCollapsedLauncherPageBounds() |
345 .Contains(location); | 343 .Contains(location); |
346 | 344 |
347 return views::BubbleDialogDelegateView:: | 345 return views::BubbleDialogDelegateView:: |
348 ShouldDescendIntoChildForEventHandling(child, location); | 346 ShouldDescendIntoChildForEventHandling(child, location); |
349 } | 347 } |
350 | 348 |
351 void AppListView::OnShutdown() { | |
352 // Nothing to do on views - the widget will soon be closed, which will tear | |
353 // everything down. | |
354 } | |
355 | |
356 void AppListView::SetProfileByPath(const base::FilePath& profile_path) { | 349 void AppListView::SetProfileByPath(const base::FilePath& profile_path) { |
357 delegate_->SetProfileByPath(profile_path); | 350 delegate_->SetProfileByPath(profile_path); |
358 app_list_main_view_->ModelChanged(); | 351 app_list_main_view_->ModelChanged(); |
359 } | 352 } |
360 | 353 |
361 void AppListView::AddObserver(AppListViewObserver* observer) { | 354 void AppListView::AddObserver(AppListViewObserver* observer) { |
362 observers_.AddObserver(observer); | 355 observers_.AddObserver(observer); |
363 } | 356 } |
364 | 357 |
365 void AppListView::RemoveObserver(AppListViewObserver* observer) { | 358 void AppListView::RemoveObserver(AppListViewObserver* observer) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 app_list_main_view_->SetVisible(true); | 699 app_list_main_view_->SetVisible(true); |
707 // Refocus the search box. However, if the app list widget does not have | 700 // Refocus the search box. However, if the app list widget does not have |
708 // focus, it means another window has already taken focus, and we *must not* | 701 // focus, it means another window has already taken focus, and we *must not* |
709 // focus the search box (or we would steal focus back into the app list). | 702 // focus the search box (or we would steal focus back into the app list). |
710 if (GetWidget()->IsActive()) | 703 if (GetWidget()->IsActive()) |
711 search_box_view_->search_box()->RequestFocus(); | 704 search_box_view_->search_box()->RequestFocus(); |
712 } | 705 } |
713 } | 706 } |
714 | 707 |
715 } // namespace app_list | 708 } // namespace app_list |
OLD | NEW |