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

Unified Diff: chrome/browser/ui/app_list/app_list_service_views.cc

Issue 225053004: Refactor views app list services to allow more code sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+sim30 Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_views.h ('k') | chrome/browser/ui/app_list/app_list_shower.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_list_service_views.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_views.cc b/chrome/browser/ui/app_list/app_list_service_views.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7be99f98913cc5b7f5d6298184e0bea013ea12c2
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_service_views.cc
@@ -0,0 +1,71 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/app_list/app_list_service_views.h"
+
+#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
+#include "chrome/browser/ui/app_list/scoped_keep_alive.h"
+
+AppListServiceViews::AppListServiceViews(
+ scoped_ptr<AppListControllerDelegate> controller_delegate)
+ : shower_(this),
+ can_dismiss_(true),
+ controller_delegate_(controller_delegate.Pass()) {
+}
+
+AppListServiceViews::~AppListServiceViews() {}
+
+void AppListServiceViews::OnViewBeingDestroyed() {
+ can_dismiss_ = true;
+ shower_.HandleViewBeingDestroyed();
+}
+
+void AppListServiceViews::Init(Profile* initial_profile) {
+ PerformStartupChecks(initial_profile);
+}
+
+void AppListServiceViews::CreateForProfile(Profile* requested_profile) {
+ shower_.CreateViewForProfile(requested_profile);
+}
+
+void AppListServiceViews::ShowForProfile(Profile* requested_profile) {
+ DCHECK(requested_profile);
+ if (requested_profile->IsManaged())
+ return;
+
+ ScopedKeepAlive keep_alive;
+
+ InvalidatePendingProfileLoads();
+ SetProfilePath(requested_profile->GetPath());
+ shower_.ShowForProfile(requested_profile);
+ RecordAppListLaunch();
+}
+
+void AppListServiceViews::DismissAppList() {
+ if (!can_dismiss_)
+ return;
+
+ shower_.DismissAppList();
+}
+
+bool AppListServiceViews::IsAppListVisible() const {
+ return shower_.IsAppListVisible();
+}
+
+gfx::NativeWindow AppListServiceViews::GetAppListWindow() {
+ return shower_.GetWindow();
+}
+
+Profile* AppListServiceViews::GetCurrentAppListProfile() {
+ return shower_.profile();
+}
+
+AppListControllerDelegate* AppListServiceViews::GetControllerDelegate() {
+ return controller_delegate_.get();
+}
+
+AppListControllerDelegate*
+AppListServiceViews::GetControllerDelegateForCreate() {
+ return controller_delegate_.get();
+}
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_views.h ('k') | chrome/browser/ui/app_list/app_list_shower.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698