| 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/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
| 12 #include "ui/app_list/app_list_constants.h" | 13 #include "ui/app_list/app_list_constants.h" |
| 13 #include "ui/app_list/app_list_model.h" | 14 #include "ui/app_list/app_list_model.h" |
| 14 #include "ui/app_list/app_list_switches.h" | 15 #include "ui/app_list/app_list_switches.h" |
| 15 #include "ui/app_list/app_list_view_delegate.h" | 16 #include "ui/app_list/app_list_view_delegate.h" |
| 16 #include "ui/app_list/speech_ui_model.h" | 17 #include "ui/app_list/speech_ui_model.h" |
| 17 #include "ui/app_list/views/app_list_background.h" | 18 #include "ui/app_list/views/app_list_background.h" |
| 18 #include "ui/app_list/views/app_list_folder_view.h" | 19 #include "ui/app_list/views/app_list_folder_view.h" |
| 19 #include "ui/app_list/views/app_list_main_view.h" | 20 #include "ui/app_list/views/app_list_main_view.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 ->apps_container_view() | 313 ->apps_container_view() |
| 313 ->apps_grid_view() | 314 ->apps_grid_view() |
| 314 ->pagination_model(); | 315 ->pagination_model(); |
| 315 } | 316 } |
| 316 | 317 |
| 317 void AppListView::InitAsBubbleInternal(gfx::NativeView parent, | 318 void AppListView::InitAsBubbleInternal(gfx::NativeView parent, |
| 318 int initial_apps_page, | 319 int initial_apps_page, |
| 319 views::BubbleBorder::Arrow arrow, | 320 views::BubbleBorder::Arrow arrow, |
| 320 bool border_accepts_events, | 321 bool border_accepts_events, |
| 321 const gfx::Vector2d& anchor_offset) { | 322 const gfx::Vector2d& anchor_offset) { |
| 323 base::Time start_time = base::Time::Now(); |
| 324 |
| 322 app_list_main_view_ = | 325 app_list_main_view_ = |
| 323 new AppListMainView(delegate_, initial_apps_page, parent); | 326 new AppListMainView(delegate_, initial_apps_page, parent); |
| 324 AddChildView(app_list_main_view_); | 327 AddChildView(app_list_main_view_); |
| 325 app_list_main_view_->SetPaintToLayer(true); | 328 app_list_main_view_->SetPaintToLayer(true); |
| 326 app_list_main_view_->SetFillsBoundsOpaquely(false); | 329 app_list_main_view_->SetFillsBoundsOpaquely(false); |
| 327 app_list_main_view_->layer()->SetMasksToBounds(true); | 330 app_list_main_view_->layer()->SetMasksToBounds(true); |
| 328 | 331 |
| 329 // Speech recognition is available only when the start page exists. | 332 // Speech recognition is available only when the start page exists. |
| 330 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { | 333 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { |
| 331 speech_view_ = new SpeechView(delegate_); | 334 speech_view_ = new SpeechView(delegate_); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // corner radius 1px smaller than the outer border, so it just reaches but | 403 // corner radius 1px smaller than the outer border, so it just reaches but |
| 401 // doesn't cover it. | 404 // doesn't cover it. |
| 402 const int kOverlayCornerRadius = | 405 const int kOverlayCornerRadius = |
| 403 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); | 406 GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(); |
| 404 overlay_view_->set_background(new AppListOverlayBackground( | 407 overlay_view_->set_background(new AppListOverlayBackground( |
| 405 kOverlayCornerRadius - (SupportsShadow() ? 0 : 1))); | 408 kOverlayCornerRadius - (SupportsShadow() ? 0 : 1))); |
| 406 AddChildView(overlay_view_); | 409 AddChildView(overlay_view_); |
| 407 | 410 |
| 408 if (delegate_) | 411 if (delegate_) |
| 409 delegate_->ViewInitialized(); | 412 delegate_->ViewInitialized(); |
| 413 |
| 414 UMA_HISTOGRAM_TIMES("Apps.AppListCreationTime", |
| 415 base::Time::Now() - start_time); |
| 410 } | 416 } |
| 411 | 417 |
| 412 void AppListView::OnBeforeBubbleWidgetInit( | 418 void AppListView::OnBeforeBubbleWidgetInit( |
| 413 views::Widget::InitParams* params, | 419 views::Widget::InitParams* params, |
| 414 views::Widget* widget) const { | 420 views::Widget* widget) const { |
| 415 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 421 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
| 416 if (delegate_ && delegate_->ForceNativeDesktop()) | 422 if (delegate_ && delegate_->ForceNativeDesktop()) |
| 417 params->native_widget = new views::DesktopNativeWidgetAura(widget); | 423 params->native_widget = new views::DesktopNativeWidgetAura(widget); |
| 418 #endif | 424 #endif |
| 419 #if defined(OS_WIN) | 425 #if defined(OS_WIN) |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 speech_view_->layer()->SetTransform(speech_transform); | 590 speech_view_->layer()->SetTransform(speech_transform); |
| 585 } | 591 } |
| 586 | 592 |
| 587 if (will_appear) | 593 if (will_appear) |
| 588 speech_view_->SetVisible(true); | 594 speech_view_->SetVisible(true); |
| 589 else | 595 else |
| 590 app_list_main_view_->SetVisible(true); | 596 app_list_main_view_->SetVisible(true); |
| 591 } | 597 } |
| 592 | 598 |
| 593 } // namespace app_list | 599 } // namespace app_list |
| OLD | NEW |