| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); | 145 DISALLOW_COPY_AND_ASSIGN(HideViewAnimationObserver); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 //////////////////////////////////////////////////////////////////////////////// | 148 //////////////////////////////////////////////////////////////////////////////// |
| 149 // AppListView: | 149 // AppListView: |
| 150 | 150 |
| 151 AppListView::AppListView(AppListViewDelegate* delegate) | 151 AppListView::AppListView(AppListViewDelegate* delegate) |
| 152 : delegate_(delegate), | 152 : delegate_(delegate), |
| 153 app_list_main_view_(NULL), | 153 app_list_main_view_(NULL), |
| 154 search_box_view_(NULL), |
| 154 speech_view_(NULL), | 155 speech_view_(NULL), |
| 155 experimental_banner_view_(NULL), | 156 experimental_banner_view_(NULL), |
| 156 overlay_view_(NULL), | 157 overlay_view_(NULL), |
| 157 animation_observer_(new HideViewAnimationObserver()) { | 158 animation_observer_(new HideViewAnimationObserver()) { |
| 158 CHECK(delegate); | 159 CHECK(delegate); |
| 159 | 160 |
| 160 delegate_->AddObserver(this); | 161 delegate_->AddObserver(this); |
| 161 delegate_->GetSpeechUI()->AddObserver(this); | 162 delegate_->GetSpeechUI()->AddObserver(this); |
| 162 } | 163 } |
| 163 | 164 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 views::BubbleBorder::Arrow arrow, | 326 views::BubbleBorder::Arrow arrow, |
| 326 bool border_accepts_events, | 327 bool border_accepts_events, |
| 327 const gfx::Vector2d& anchor_offset) { | 328 const gfx::Vector2d& anchor_offset) { |
| 328 base::Time start_time = base::Time::Now(); | 329 base::Time start_time = base::Time::Now(); |
| 329 | 330 |
| 330 app_list_main_view_ = new AppListMainView(delegate_); | 331 app_list_main_view_ = new AppListMainView(delegate_); |
| 331 AddChildView(app_list_main_view_); | 332 AddChildView(app_list_main_view_); |
| 332 app_list_main_view_->SetPaintToLayer(true); | 333 app_list_main_view_->SetPaintToLayer(true); |
| 333 app_list_main_view_->SetFillsBoundsOpaquely(false); | 334 app_list_main_view_->SetFillsBoundsOpaquely(false); |
| 334 app_list_main_view_->layer()->SetMasksToBounds(true); | 335 app_list_main_view_->layer()->SetMasksToBounds(true); |
| 335 app_list_main_view_->Init(parent, initial_apps_page); | 336 |
| 337 search_box_view_ = new SearchBoxView(app_list_main_view_, delegate_); |
| 338 search_box_view_->SetPaintToLayer(true); |
| 339 search_box_view_->SetFillsBoundsOpaquely(false); |
| 340 search_box_view_->layer()->SetMasksToBounds(true); |
| 341 AddChildView(search_box_view_); |
| 342 |
| 343 app_list_main_view_->Init(parent, initial_apps_page, search_box_view_); |
| 336 | 344 |
| 337 // Speech recognition is available only when the start page exists. | 345 // Speech recognition is available only when the start page exists. |
| 338 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { | 346 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { |
| 339 speech_view_ = new SpeechView(delegate_); | 347 speech_view_ = new SpeechView(delegate_); |
| 340 speech_view_->SetVisible(false); | 348 speech_view_->SetVisible(false); |
| 341 speech_view_->SetPaintToLayer(true); | 349 speech_view_->SetPaintToLayer(true); |
| 342 speech_view_->SetFillsBoundsOpaquely(false); | 350 speech_view_->SetFillsBoundsOpaquely(false); |
| 343 speech_view_->layer()->SetOpacity(0.0f); | 351 speech_view_->layer()->SetOpacity(0.0f); |
| 344 AddChildView(speech_view_); | 352 AddChildView(speech_view_); |
| 345 } | 353 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 GetWidget()->Deactivate(); | 494 GetWidget()->Deactivate(); |
| 487 Close(); | 495 Close(); |
| 488 } | 496 } |
| 489 return true; | 497 return true; |
| 490 } | 498 } |
| 491 | 499 |
| 492 return false; | 500 return false; |
| 493 } | 501 } |
| 494 | 502 |
| 495 void AppListView::Layout() { | 503 void AppListView::Layout() { |
| 504 search_box_view_->SetBoundsRect( |
| 505 app_list_main_view_->contents_view()->GetDefaultSearchBoxBounds()); |
| 506 |
| 496 const gfx::Rect contents_bounds = GetContentsBounds(); | 507 const gfx::Rect contents_bounds = GetContentsBounds(); |
| 497 app_list_main_view_->SetBoundsRect(contents_bounds); | 508 app_list_main_view_->SetBoundsRect(contents_bounds); |
| 498 | 509 |
| 499 if (speech_view_) { | 510 if (speech_view_) { |
| 500 gfx::Rect speech_bounds = contents_bounds; | 511 gfx::Rect speech_bounds = contents_bounds; |
| 501 int preferred_height = speech_view_->GetPreferredSize().height(); | 512 int preferred_height = speech_view_->GetPreferredSize().height(); |
| 502 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); | 513 speech_bounds.Inset(kSpeechUIMargin, kSpeechUIMargin); |
| 503 speech_bounds.set_height(std::min(speech_bounds.height(), | 514 speech_bounds.set_height(std::min(speech_bounds.height(), |
| 504 preferred_height)); | 515 preferred_height)); |
| 505 speech_bounds.Inset(-speech_view_->GetInsets()); | 516 speech_bounds.Inset(-speech_view_->GetInsets()); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 speech_view_->layer()->SetTransform(speech_transform); | 606 speech_view_->layer()->SetTransform(speech_transform); |
| 596 } | 607 } |
| 597 | 608 |
| 598 if (will_appear) | 609 if (will_appear) |
| 599 speech_view_->SetVisible(true); | 610 speech_view_->SetVisible(true); |
| 600 else | 611 else |
| 601 app_list_main_view_->SetVisible(true); | 612 app_list_main_view_->SetVisible(true); |
| 602 } | 613 } |
| 603 | 614 |
| 604 } // namespace app_list | 615 } // namespace app_list |
| OLD | NEW |