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

Unified Diff: chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm

Issue 782673002: MacViews: tryjobs for toolkit_views=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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
Index: chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm
diff --git a/chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm b/chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..2398be2ae17464c15725231b8b7a23729c803fa0
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_service_cocoa_mac.mm
@@ -0,0 +1,79 @@
+// Copyright 2015 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_cocoa_mac.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/ui/app_list/app_list_controller_delegate_impl.h"
+#include "chrome/browser/ui/app_list/app_list_view_delegate.h"
+#import "ui/app_list/cocoa/app_list_view_controller.h"
+#import "ui/app_list/cocoa/app_list_window_controller.h"
+
+AppListServiceCocoaMac::~AppListServiceCocoaMac() {
+}
+
+// static
+AppListServiceCocoaMac* AppListServiceCocoaMac::GetInstance() {
+ return Singleton<AppListServiceCocoaMac,
+ LeakySingletonTraits<AppListServiceCocoaMac>>::get();
+}
+
+Profile* AppListServiceCocoaMac::GetCurrentAppListProfile() {
+ return profile_;
+}
+
+AppListControllerDelegate* AppListServiceCocoaMac::GetControllerDelegate() {
+ return controller_delegate_.get();
+}
+
+void AppListServiceCocoaMac::CreateForProfile(Profile* requested_profile) {
+ DCHECK(requested_profile);
+ InvalidatePendingProfileLoads();
+ if (profile_ && requested_profile->IsSameProfile(profile_))
+ return;
+
+ profile_ = requested_profile->GetOriginalProfile();
+ SetProfilePath(profile_->GetPath());
+
+ if (!window_controller_)
+ window_controller_.reset([[AppListWindowController alloc] init]);
+
+ [[window_controller_ appListViewController] setDelegate:nil];
+ [[window_controller_ appListViewController]
+ setDelegate:GetViewDelegate(profile_)];
+}
+
+void AppListServiceCocoaMac::ShowForProfile(Profile* requested_profile) {
+ CreateForProfile(requested_profile);
+ DCHECK(ReadyToShow());
+ ShowWindowNearDock();
+}
+
+void AppListServiceCocoaMac::DestroyAppList() {
+ // Due to reference counting, Mac can't guarantee that the widget is deleted,
+ // but mac supports a visible app list with a NULL profile, so there's also no
+ // need to tear it down completely.
+ DismissAppList();
+ [[window_controller_ appListViewController] setDelegate:NULL];
+
+ profile_ = NULL;
+}
+
+NSWindow* AppListServiceCocoaMac::GetNativeWindow() const {
+ return [window_controller_ window];
+}
+
+bool AppListServiceCocoaMac::ReadyToShow() {
+ if (!window_controller_) {
+ // Note that this will start showing an unpopulated window, the caller needs
+ // to ensure it will be populated later.
+ window_controller_.reset([[AppListWindowController alloc] init]);
+ }
+ return true; // Cocoa app list can be shown empty.
+}
+
+AppListServiceCocoaMac::AppListServiceCocoaMac()
+ : profile_(nullptr),
+ controller_delegate_(new AppListControllerDelegateImpl(this)) {
+}
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_cocoa_mac.h ('k') | chrome/browser/ui/app_list/app_list_service_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698