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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 683703002: Notify launcher page with onTransitionChanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launcher_page_api_show_state_notify
Patch Set: nullptr like it's 1999 Created 6 years, 1 month 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 "chrome/browser/ui/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/custom_launcher_page_contents.h" 9 #include "apps/custom_launcher_page_contents.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 app_list::StartPageService::Get(profile_); 446 app_list::StartPageService::Get(profile_);
447 if (service) { 447 if (service) {
448 service->AppListShown(); 448 service->AppListShown();
449 if (service->HotwordEnabled()) { 449 if (service->HotwordEnabled()) {
450 HotwordService* hotword_service = 450 HotwordService* hotword_service =
451 HotwordServiceFactory::GetForProfile(profile_); 451 HotwordServiceFactory::GetForProfile(profile_);
452 if (hotword_service) 452 if (hotword_service)
453 hotword_service->RequestHotwordSession(this); 453 hotword_service->RequestHotwordSession(this);
454 } 454 }
455 } 455 }
456 AttachLauncherPageEventDispatcher();
457 }
458
459 void AppListViewDelegate::ViewReinitializedForProfileChange() {
460 AttachLauncherPageEventDispatcher();
461 }
462
463 void AppListViewDelegate::AttachLauncherPageEventDispatcher() {
464 std::vector<GURL> custom_launcher_page_urls;
465 GetCustomLauncherPageUrls(profile_, &custom_launcher_page_urls);
466
467 // Only the first custom launcher page gets events dispatched to it.
468 if (!custom_launcher_page_urls.empty()) {
469 chrome::HostDesktopType desktop = chrome::GetHostDesktopTypeForNativeWindow(
470 controller_->GetAppListWindow());
tapted 2014/11/03 00:31:20 (overridden by later comments, but worth noting:
calamity 2014/11/06 02:36:31 Acknowledged.
471 launcher_page_event_dispatcher_.reset(
472 new app_list::LauncherPageEventDispatcherViews(
473 desktop, profile_, custom_launcher_page_urls[0].host()));
474 }
456 } 475 }
457 476
458 void AppListViewDelegate::Dismiss() { 477 void AppListViewDelegate::Dismiss() {
459 controller_->DismissView(); 478 controller_->DismissView();
460 } 479 }
461 480
462 void AppListViewDelegate::ViewClosing() { 481 void AppListViewDelegate::ViewClosing() {
463 controller_->ViewClosing(); 482 controller_->ViewClosing();
464 483
484 launcher_page_event_dispatcher_.reset();
tapted 2014/11/03 00:31:20 This lifetime is really confusing. Why can't the e
calamity 2014/11/06 02:36:31 Done.
485
465 if (!profile_) 486 if (!profile_)
466 return; 487 return;
467 488
468 app_list::StartPageService* service = 489 app_list::StartPageService* service =
469 app_list::StartPageService::Get(profile_); 490 app_list::StartPageService::Get(profile_);
470 if (service) { 491 if (service) {
471 service->AppListHidden(); 492 service->AppListHidden();
472 if (service->HotwordEnabled()) { 493 if (service->HotwordEnabled()) {
473 HotwordService* hotword_service = 494 HotwordService* hotword_service =
474 HotwordServiceFactory::GetForProfile(profile_); 495 HotwordServiceFactory::GetForProfile(profile_);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 716
696 // SigninManagerFactory is not a leaky singleton (unlike this class), and 717 // SigninManagerFactory is not a leaky singleton (unlike this class), and
697 // its destructor will check that it has no remaining observers. 718 // its destructor will check that it has no remaining observers.
698 scoped_observer_.RemoveAll(); 719 scoped_observer_.RemoveAll();
699 SigninManagerFactory::GetInstance()->RemoveObserver(this); 720 SigninManagerFactory::GetInstance()->RemoveObserver(this);
700 break; 721 break;
701 default: 722 default:
702 NOTREACHED(); 723 NOTREACHED();
703 } 724 }
704 } 725 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698