Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ui/app_list/views/app_list_view.cc

Issue 2339523004: Remove old (dead) app list code. (Closed)
Patch Set: Address nonbistytftatl review. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 208
209 AppListView::~AppListView() { 209 AppListView::~AppListView() {
210 delegate_->GetSpeechUI()->RemoveObserver(this); 210 delegate_->GetSpeechUI()->RemoveObserver(this);
211 delegate_->RemoveObserver(this); 211 delegate_->RemoveObserver(this);
212 animation_observer_.reset(); 212 animation_observer_.reset();
213 // Remove child views first to ensure no remaining dependencies on delegate_. 213 // Remove child views first to ensure no remaining dependencies on delegate_.
214 RemoveAllChildViews(true); 214 RemoveAllChildViews(true);
215 } 215 }
216 216
217 void AppListView::InitAsBubbleAttachedToAnchor(
218 gfx::NativeView parent,
219 int initial_apps_page,
220 views::View* anchor,
221 const gfx::Vector2d& anchor_offset,
222 views::BubbleBorder::Arrow arrow,
223 bool border_accepts_events) {
224 SetAnchorView(anchor);
225 InitAsBubbleInternal(
226 parent, initial_apps_page, arrow, border_accepts_events, anchor_offset);
227 }
228
229 void AppListView::InitAsBubbleAtFixedLocation( 217 void AppListView::InitAsBubbleAtFixedLocation(
230 gfx::NativeView parent, 218 gfx::NativeView parent,
231 int initial_apps_page, 219 int initial_apps_page,
232 const gfx::Point& anchor_point_in_screen, 220 const gfx::Point& anchor_point_in_screen,
233 views::BubbleBorder::Arrow arrow, 221 views::BubbleBorder::Arrow arrow,
234 bool border_accepts_events) { 222 bool border_accepts_events) {
235 SetAnchorView(NULL);
236 SetAnchorRect(gfx::Rect(anchor_point_in_screen, gfx::Size())); 223 SetAnchorRect(gfx::Rect(anchor_point_in_screen, gfx::Size()));
224 // TODO(mgiuca): Inline InitAsBubbleInternal, since there is only one caller.
237 InitAsBubbleInternal( 225 InitAsBubbleInternal(
238 parent, initial_apps_page, arrow, border_accepts_events, gfx::Vector2d()); 226 parent, initial_apps_page, arrow, border_accepts_events, gfx::Vector2d());
239 } 227 }
240 228
241 void AppListView::InitAsFramelessWindow(gfx::NativeView parent, 229 void AppListView::InitAsFramelessWindow(gfx::NativeView parent,
242 int initial_apps_page, 230 int initial_apps_page,
243 gfx::Rect bounds) { 231 gfx::Rect bounds) {
244 InitContents(parent, initial_apps_page); 232 InitContents(parent, initial_apps_page);
245 overlay_view_ = new AppListOverlayView(0 /* no corners */); 233 overlay_view_ = new AppListOverlayView(0 /* no corners */);
246 AddChildView(overlay_view_); 234 AddChildView(overlay_view_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 search_box_widget_->GetLayer()->GetAnimator()); 309 search_box_widget_->GetLayer()->GetAnimator());
322 const float kSearchBoxWidgetOpacity = 0.5f; 310 const float kSearchBoxWidgetOpacity = 0.5f;
323 search_box_widget_->GetLayer()->SetOpacity(visible ? kSearchBoxWidgetOpacity 311 search_box_widget_->GetLayer()->SetOpacity(visible ? kSearchBoxWidgetOpacity
324 : 1.0f); 312 : 1.0f);
325 search_box_view_->SetEnabled(!visible); 313 search_box_view_->SetEnabled(!visible);
326 if (!visible) 314 if (!visible)
327 search_box_view_->search_box()->RequestFocus(); 315 search_box_view_->search_box()->RequestFocus();
328 } 316 }
329 } 317 }
330 318
331 bool AppListView::ShouldCenterWindow() const {
332 return delegate_->ShouldCenterWindow();
333 }
334
335 gfx::Size AppListView::GetPreferredSize() const { 319 gfx::Size AppListView::GetPreferredSize() const {
336 return app_list_main_view_->GetPreferredSize(); 320 return app_list_main_view_->GetPreferredSize();
337 } 321 }
338 322
339 void AppListView::OnPaint(gfx::Canvas* canvas) { 323 void AppListView::OnPaint(gfx::Canvas* canvas) {
340 views::BubbleDialogDelegateView::OnPaint(canvas); 324 views::BubbleDialogDelegateView::OnPaint(canvas);
341 if (!next_paint_callback_.is_null()) { 325 if (!next_paint_callback_.is_null()) {
342 next_paint_callback_.Run(); 326 next_paint_callback_.Run();
343 next_paint_callback_.Reset(); 327 next_paint_callback_.Reset();
344 } 328 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const { 576 void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const {
593 DCHECK(mask); 577 DCHECK(mask);
594 DCHECK(GetBubbleFrameView()); 578 DCHECK(GetBubbleFrameView());
595 579
596 mask->addRect(gfx::RectToSkRect( 580 mask->addRect(gfx::RectToSkRect(
597 GetBubbleFrameView()->GetContentsBounds())); 581 GetBubbleFrameView()->GetContentsBounds()));
598 } 582 }
599 583
600 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { 584 bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) {
601 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); 585 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code());
602 if (switches::IsExperimentalAppListEnabled()) { 586
603 // If the ContentsView does not handle the back action, then this is the 587 // If the ContentsView does not handle the back action, then this is the
604 // top level, so we close the app list. 588 // top level, so we close the app list.
605 if (!app_list_main_view_->contents_view()->Back()) { 589 if (!app_list_main_view_->contents_view()->Back()) {
606 GetWidget()->Deactivate();
607 CloseAppList();
608 }
609 } else if (app_list_main_view_->search_box_view()->HasSearch()) {
610 app_list_main_view_->search_box_view()->ClearSearch();
611 } else if (app_list_main_view_->contents_view()
612 ->apps_container_view()
613 ->IsInFolderView()) {
614 app_list_main_view_->contents_view()
615 ->apps_container_view()
616 ->app_list_folder_view()
617 ->CloseFolderPage();
618 } else {
619 GetWidget()->Deactivate(); 590 GetWidget()->Deactivate();
620 CloseAppList(); 591 CloseAppList();
621 } 592 }
593
622 // Don't let DialogClientView handle the accelerator. 594 // Don't let DialogClientView handle the accelerator.
623 return true; 595 return true;
624 } 596 }
625 597
626 void AppListView::Layout() { 598 void AppListView::Layout() {
627 const gfx::Rect contents_bounds = GetContentsBounds(); 599 const gfx::Rect contents_bounds = GetContentsBounds();
628 600
629 // Make sure to layout |app_list_main_view_| and |speech_view_| at the center 601 // Make sure to layout |app_list_main_view_| and |speech_view_| at the center
630 // of the widget. 602 // of the widget.
631 gfx::Rect centered_bounds = contents_bounds; 603 gfx::Rect centered_bounds = contents_bounds;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 app_list_main_view_->SetVisible(true); 712 app_list_main_view_->SetVisible(true);
741 // Refocus the search box. However, if the app list widget does not have 713 // Refocus the search box. However, if the app list widget does not have
742 // focus, it means another window has already taken focus, and we *must not* 714 // focus, it means another window has already taken focus, and we *must not*
743 // focus the search box (or we would steal focus back into the app list). 715 // focus the search box (or we would steal focus back into the app list).
744 if (GetWidget()->IsActive()) 716 if (GetWidget()->IsActive())
745 search_box_view_->search_box()->RequestFocus(); 717 search_box_view_->search_box()->RequestFocus();
746 } 718 }
747 } 719 }
748 720
749 } // namespace app_list 721 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698