| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 void AppListView::OnThemeChanged() { | 331 void AppListView::OnThemeChanged() { |
| 332 #if defined(OS_WIN) | 332 #if defined(OS_WIN) |
| 333 GetWidget()->Close(); | 333 GetWidget()->Close(); |
| 334 #endif | 334 #endif |
| 335 } | 335 } |
| 336 | 336 |
| 337 bool AppListView::ShouldHandleSystemCommands() const { | 337 bool AppListView::ShouldHandleSystemCommands() const { |
| 338 return true; | 338 return true; |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool AppListView::ShouldDescendIntoChildForEventHandling( |
| 342 gfx::NativeView child, |
| 343 const gfx::Point& location) { |
| 344 // While on the start page, don't descend into the custom launcher page. Since |
| 345 // the only valid action is to open it. |
| 346 ContentsView* contents_view = app_list_main_view_->contents_view(); |
| 347 if (contents_view->GetActiveState() == AppListModel::STATE_START) |
| 348 return !contents_view->GetCustomPageCollapsedBounds().Contains(location); |
| 349 |
| 350 return views::BubbleDelegateView::ShouldDescendIntoChildForEventHandling( |
| 351 child, location); |
| 352 } |
| 353 |
| 341 void AppListView::Prerender() { | 354 void AppListView::Prerender() { |
| 342 app_list_main_view_->Prerender(); | 355 app_list_main_view_->Prerender(); |
| 343 } | 356 } |
| 344 | 357 |
| 345 void AppListView::OnProfilesChanged() { | 358 void AppListView::OnProfilesChanged() { |
| 346 app_list_main_view_->search_box_view()->InvalidateMenu(); | 359 app_list_main_view_->search_box_view()->InvalidateMenu(); |
| 347 } | 360 } |
| 348 | 361 |
| 349 void AppListView::OnShutdown() { | 362 void AppListView::OnShutdown() { |
| 350 // Nothing to do on views - the widget will soon be closed, which will tear | 363 // Nothing to do on views - the widget will soon be closed, which will tear |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 speech_view_->layer()->SetOpacity(0.0f); | 440 speech_view_->layer()->SetOpacity(0.0f); |
| 428 AddChildView(speech_view_); | 441 AddChildView(speech_view_); |
| 429 } | 442 } |
| 430 | 443 |
| 431 OnProfilesChanged(); | 444 OnProfilesChanged(); |
| 432 } | 445 } |
| 433 | 446 |
| 434 void AppListView::InitChildWidgets() { | 447 void AppListView::InitChildWidgets() { |
| 435 DCHECK(search_box_view_); | 448 DCHECK(search_box_view_); |
| 436 | 449 |
| 437 app_list_main_view_->InitWidgets(); | |
| 438 | |
| 439 // Create the search box widget. | 450 // Create the search box widget. |
| 440 views::Widget::InitParams search_box_widget_params( | 451 views::Widget::InitParams search_box_widget_params( |
| 441 views::Widget::InitParams::TYPE_CONTROL); | 452 views::Widget::InitParams::TYPE_CONTROL); |
| 442 search_box_widget_params.parent = GetWidget()->GetNativeView(); | 453 search_box_widget_params.parent = GetWidget()->GetNativeView(); |
| 443 search_box_widget_params.opacity = | 454 search_box_widget_params.opacity = |
| 444 views::Widget::InitParams::TRANSLUCENT_WINDOW; | 455 views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 445 | 456 |
| 446 // Create a widget for the SearchBoxView to live in. This allows the | 457 // Create a widget for the SearchBoxView to live in. This allows the |
| 447 // SearchBoxView to be on top of the custom launcher page's WebContents | 458 // SearchBoxView to be on top of the custom launcher page's WebContents |
| 448 // (otherwise the search box events will be captured by the WebContents). | 459 // (otherwise the search box events will be captured by the WebContents). |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 768 |
| 758 if (will_appear) { | 769 if (will_appear) { |
| 759 speech_view_->SetVisible(true); | 770 speech_view_->SetVisible(true); |
| 760 } else { | 771 } else { |
| 761 app_list_main_view_->SetVisible(true); | 772 app_list_main_view_->SetVisible(true); |
| 762 search_box_view_->search_box()->RequestFocus(); | 773 search_box_view_->search_box()->RequestFocus(); |
| 763 } | 774 } |
| 764 } | 775 } |
| 765 | 776 |
| 766 } // namespace app_list | 777 } // namespace app_list |
| OLD | NEW |