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

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

Issue 2127713005: Purge AppListMenu, and the app list profile switcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160707-Apps-RemoveSettings
Patch Set: Created 4 years, 5 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
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 : delegate_(delegate), 205 : delegate_(delegate),
206 app_list_main_view_(nullptr), 206 app_list_main_view_(nullptr),
207 speech_view_(nullptr), 207 speech_view_(nullptr),
208 search_box_focus_host_(nullptr), 208 search_box_focus_host_(nullptr),
209 search_box_widget_(nullptr), 209 search_box_widget_(nullptr),
210 search_box_view_(nullptr), 210 search_box_view_(nullptr),
211 overlay_view_(nullptr), 211 overlay_view_(nullptr),
212 animation_observer_(new HideViewAnimationObserver()) { 212 animation_observer_(new HideViewAnimationObserver()) {
213 CHECK(delegate); 213 CHECK(delegate);
214 214
215 delegate_->AddObserver(this);
216 delegate_->GetSpeechUI()->AddObserver(this); 215 delegate_->GetSpeechUI()->AddObserver(this);
217 } 216 }
218 217
219 AppListView::~AppListView() { 218 AppListView::~AppListView() {
220 delegate_->GetSpeechUI()->RemoveObserver(this); 219 delegate_->GetSpeechUI()->RemoveObserver(this);
221 delegate_->RemoveObserver(this);
222 animation_observer_.reset(); 220 animation_observer_.reset();
223 // Remove child views first to ensure no remaining dependencies on delegate_. 221 // Remove child views first to ensure no remaining dependencies on delegate_.
224 RemoveAllChildViews(true); 222 RemoveAllChildViews(true);
225 } 223 }
226 224
227 void AppListView::InitAsBubbleAttachedToAnchor( 225 void AppListView::InitAsBubbleAttachedToAnchor(
228 gfx::NativeView parent, 226 gfx::NativeView parent,
229 int initial_apps_page, 227 int initial_apps_page,
230 views::View* anchor, 228 views::View* anchor,
231 const gfx::Vector2d& anchor_offset, 229 const gfx::Vector2d& anchor_offset,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 .Contains(location); 375 .Contains(location);
378 376
379 return views::BubbleDialogDelegateView:: 377 return views::BubbleDialogDelegateView::
380 ShouldDescendIntoChildForEventHandling(child, location); 378 ShouldDescendIntoChildForEventHandling(child, location);
381 } 379 }
382 380
383 void AppListView::Prerender() { 381 void AppListView::Prerender() {
384 app_list_main_view_->Prerender(); 382 app_list_main_view_->Prerender();
385 } 383 }
386 384
387 void AppListView::OnProfilesChanged() {
388 app_list_main_view_->search_box_view()->InvalidateMenu();
389 }
390
391 void AppListView::OnShutdown() {
392 // Nothing to do on views - the widget will soon be closed, which will tear
393 // everything down.
394 }
395
396 void AppListView::SetProfileByPath(const base::FilePath& profile_path) { 385 void AppListView::SetProfileByPath(const base::FilePath& profile_path) {
397 delegate_->SetProfileByPath(profile_path); 386 delegate_->SetProfileByPath(profile_path);
398 app_list_main_view_->ModelChanged(); 387 app_list_main_view_->ModelChanged();
399 } 388 }
400 389
401 void AppListView::AddObserver(AppListViewObserver* observer) { 390 void AppListView::AddObserver(AppListViewObserver* observer) {
402 observers_.AddObserver(observer); 391 observers_.AddObserver(observer);
403 } 392 }
404 393
405 void AppListView::RemoveObserver(AppListViewObserver* observer) { 394 void AppListView::RemoveObserver(AppListViewObserver* observer) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 451
463 // Speech recognition is available only when the start page exists. 452 // Speech recognition is available only when the start page exists.
464 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) { 453 if (delegate_ && delegate_->IsSpeechRecognitionEnabled()) {
465 speech_view_ = new SpeechView(delegate_); 454 speech_view_ = new SpeechView(delegate_);
466 speech_view_->SetVisible(false); 455 speech_view_->SetVisible(false);
467 speech_view_->SetPaintToLayer(true); 456 speech_view_->SetPaintToLayer(true);
468 speech_view_->layer()->SetFillsBoundsOpaquely(false); 457 speech_view_->layer()->SetFillsBoundsOpaquely(false);
469 speech_view_->layer()->SetOpacity(0.0f); 458 speech_view_->layer()->SetOpacity(0.0f);
470 AddChildView(speech_view_); 459 AddChildView(speech_view_);
471 } 460 }
472
473 OnProfilesChanged();
474 } 461 }
475 462
476 void AppListView::InitChildWidgets() { 463 void AppListView::InitChildWidgets() {
477 DCHECK(search_box_view_); 464 DCHECK(search_box_view_);
478 465
479 // Create the search box widget. 466 // Create the search box widget.
480 views::Widget::InitParams search_box_widget_params( 467 views::Widget::InitParams search_box_widget_params(
481 views::Widget::InitParams::TYPE_CONTROL); 468 views::Widget::InitParams::TYPE_CONTROL);
482 search_box_widget_params.parent = GetWidget()->GetNativeView(); 469 search_box_widget_params.parent = GetWidget()->GetNativeView();
483 search_box_widget_params.opacity = 470 search_box_widget_params.opacity =
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 app_list_main_view_->SetVisible(true); 766 app_list_main_view_->SetVisible(true);
780 // Refocus the search box. However, if the app list widget does not have 767 // Refocus the search box. However, if the app list widget does not have
781 // focus, it means another window has already taken focus, and we *must not* 768 // focus, it means another window has already taken focus, and we *must not*
782 // focus the search box (or we would steal focus back into the app list). 769 // focus the search box (or we would steal focus back into the app list).
783 if (GetWidget()->IsActive()) 770 if (GetWidget()->IsActive())
784 search_box_view_->search_box()->RequestFocus(); 771 search_box_view_->search_box()->RequestFocus();
785 } 772 }
786 } 773 }
787 774
788 } // namespace app_list 775 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | ui/app_list/views/search_box_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698