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

Side by Side Diff: ui/app_list/cocoa/app_list_view_controller.mm

Issue 117683002: Show the Mac app launcher window with a spinner while loading Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, ensure no startup flows regress Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #import "ui/app_list/cocoa/app_list_view_controller.h" 5 #import "ui/app_list/cocoa/app_list_view_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "skia/ext/skia_utils_mac.h" 10 #include "skia/ext/skia_utils_mac.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 - (NSView*)backgroundView { 153 - (NSView*)backgroundView {
154 return backgroundView_; 154 return backgroundView_;
155 } 155 }
156 156
157 - (app_list::AppListViewDelegate*)delegate { 157 - (app_list::AppListViewDelegate*)delegate {
158 return delegate_.get(); 158 return delegate_.get();
159 } 159 }
160 160
161 - (void)setDelegate:(scoped_ptr<app_list::AppListViewDelegate>)newDelegate { 161 - (void)setDelegate:(scoped_ptr<app_list::AppListViewDelegate>)newDelegate {
162 if (delegate_) { 162 if (delegate_) {
163 // Ensure the search box is cleared when switching profiles.
164 if ([self searchBoxModel])
165 [self searchBoxModel]->SetText(base::string16());
166
163 // First clean up, in reverse order. 167 // First clean up, in reverse order.
164 app_list_model_observer_bridge_.reset(); 168 app_list_model_observer_bridge_.reset();
165 [appsSearchResultsController_ setDelegate:nil]; 169 [appsSearchResultsController_ setDelegate:nil];
166 [appsSearchBoxController_ setDelegate:nil]; 170 [appsSearchBoxController_ setDelegate:nil];
167 [appsGridController_ setDelegate:nil]; 171 [appsGridController_ setDelegate:nil];
168 } 172 }
169 delegate_.reset(newDelegate.release()); 173 delegate_.reset(newDelegate.release());
170 if (!delegate_) 174 if (delegate_) {
175 [loadingIndicator_ stopAnimation:self];
176 } else {
177 [loadingIndicator_ startAnimation:self];
171 return; 178 return;
179 }
180
172 [appsGridController_ setDelegate:delegate_.get()]; 181 [appsGridController_ setDelegate:delegate_.get()];
173 [appsSearchBoxController_ setDelegate:self]; 182 [appsSearchBoxController_ setDelegate:self];
174 [appsSearchResultsController_ setDelegate:self]; 183 [appsSearchResultsController_ setDelegate:self];
175 app_list_model_observer_bridge_.reset( 184 app_list_model_observer_bridge_.reset(
176 new app_list::AppListModelObserverBridge(self)); 185 new app_list::AppListModelObserverBridge(self));
177 [self onProfilesChanged]; 186 [self onProfilesChanged];
178 } 187 }
179 188
180 -(void)loadAndSetView { 189 -(void)loadAndSetView {
181 pagerControl_.reset([[AppListPagerView alloc] init]); 190 pagerControl_.reset([[AppListPagerView alloc] init]);
(...skipping 11 matching lines...) Expand all
193 NSMakeRect(0, 0, NSMaxX(contentsRect), NSMaxY(contentsRect))]); 202 NSMakeRect(0, 0, NSMaxX(contentsRect), NSMaxY(contentsRect))]);
194 appsSearchBoxController_.reset( 203 appsSearchBoxController_.reset(
195 [[AppsSearchBoxController alloc] initWithFrame: 204 [[AppsSearchBoxController alloc] initWithFrame:
196 NSMakeRect(0, 0, NSWidth(contentsRect), kSearchInputHeight)]); 205 NSMakeRect(0, 0, NSWidth(contentsRect), kSearchInputHeight)]);
197 appsSearchResultsController_.reset( 206 appsSearchResultsController_.reset(
198 [[AppsSearchResultsController alloc] initWithAppsSearchResultsFrameSize: 207 [[AppsSearchResultsController alloc] initWithAppsSearchResultsFrameSize:
199 [contentsView_ bounds].size]); 208 [contentsView_ bounds].size]);
200 base::scoped_nsobject<NSView> containerView( 209 base::scoped_nsobject<NSView> containerView(
201 [[NSView alloc] initWithFrame:[backgroundView_ frame]]); 210 [[NSView alloc] initWithFrame:[backgroundView_ frame]]);
202 211
212 loadingIndicator_.reset(
213 [[NSProgressIndicator alloc] initWithFrame:NSZeroRect]);
214 [loadingIndicator_ setStyle:NSProgressIndicatorSpinningStyle];
215 [loadingIndicator_ sizeToFit];
216 NSRect indicatorRect = [loadingIndicator_ frame];
217 indicatorRect.origin.x = NSWidth(contentsRect) / 2 - NSMidX(indicatorRect);
218 indicatorRect.origin.y = NSHeight(contentsRect) / 2 - NSMidY(indicatorRect);
219 [loadingIndicator_ setFrame:indicatorRect];
220 [loadingIndicator_ setDisplayedWhenStopped:NO];
221 [loadingIndicator_ startAnimation:self];
222
203 [contentsView_ addSubview:[appsGridController_ view]]; 223 [contentsView_ addSubview:[appsGridController_ view]];
204 [contentsView_ addSubview:pagerControl_]; 224 [contentsView_ addSubview:pagerControl_];
225 [contentsView_ addSubview:loadingIndicator_];
205 [backgroundView_ addSubview:contentsView_]; 226 [backgroundView_ addSubview:contentsView_];
206 [backgroundView_ addSubview:[appsSearchResultsController_ view]]; 227 [backgroundView_ addSubview:[appsSearchResultsController_ view]];
207 [backgroundView_ addSubview:[appsSearchBoxController_ view]]; 228 [backgroundView_ addSubview:[appsSearchBoxController_ view]];
208 [containerView addSubview:backgroundView_]; 229 [containerView addSubview:backgroundView_];
209 [self setView:containerView]; 230 [self setView:containerView];
210 } 231 }
211 232
212 - (void)revealSearchResults:(BOOL)show { 233 - (void)revealSearchResults:(BOOL)show {
213 if (show == showingSearchResults_) 234 if (show == showingSearchResults_)
214 return; 235 return;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 366
346 [backgroundView_ setHidden:YES]; 367 [backgroundView_ setHidden:YES];
347 signinViewController_.reset( 368 signinViewController_.reset(
348 [[SigninViewController alloc] initWithFrame:[backgroundView_ frame] 369 [[SigninViewController alloc] initWithFrame:[backgroundView_ frame]
349 cornerRadius:kBubbleCornerRadius 370 cornerRadius:kBubbleCornerRadius
350 delegate:signinDelegate]); 371 delegate:signinDelegate]);
351 [[self view] addSubview:[signinViewController_ view]]; 372 [[self view] addSubview:[signinViewController_ view]];
352 } 373 }
353 374
354 @end 375 @end
OLDNEW
« ui/app_list/cocoa/app_list_view_controller.h ('K') | « ui/app_list/cocoa/app_list_view_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698