OLD | NEW |
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // not properly tear down these dependencies. | 131 // not properly tear down these dependencies. |
132 DCHECK(delegate_ == NULL); | 132 DCHECK(delegate_ == NULL); |
133 [appsGridController_ setPaginationObserver:nil]; | 133 [appsGridController_ setPaginationObserver:nil]; |
134 [super dealloc]; | 134 [super dealloc]; |
135 } | 135 } |
136 | 136 |
137 - (AppsSearchBoxController*)searchBoxController { | 137 - (AppsSearchBoxController*)searchBoxController { |
138 return appsSearchBoxController_; | 138 return appsSearchBoxController_; |
139 } | 139 } |
140 | 140 |
| 141 - (AppsSearchResultsController*)appsSearchResultsController { |
| 142 return appsSearchResultsController_; |
| 143 } |
| 144 |
141 - (BOOL)showingSearchResults { | 145 - (BOOL)showingSearchResults { |
142 return showingSearchResults_; | 146 return showingSearchResults_; |
143 } | 147 } |
144 | 148 |
145 - (AppsGridController*)appsGridController { | 149 - (AppsGridController*)appsGridController { |
146 return appsGridController_; | 150 return appsGridController_; |
147 } | 151 } |
148 | 152 |
149 - (NSSegmentedControl*)pagerControl { | 153 - (NSSegmentedControl*)pagerControl { |
150 return pagerControl_; | 154 return pagerControl_; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 266 } |
263 | 267 |
264 - (void)pageVisibilityChanged { | 268 - (void)pageVisibilityChanged { |
265 [pagerControl_ setNeedsDisplay:YES]; | 269 [pagerControl_ setNeedsDisplay:YES]; |
266 } | 270 } |
267 | 271 |
268 - (NSInteger)pagerSegmentAtLocation:(NSPoint)locationInWindow { | 272 - (NSInteger)pagerSegmentAtLocation:(NSPoint)locationInWindow { |
269 return [pagerControl_ findAndHighlightSegmentAtLocation:locationInWindow]; | 273 return [pagerControl_ findAndHighlightSegmentAtLocation:locationInWindow]; |
270 } | 274 } |
271 | 275 |
| 276 - (void)ensureAppsPagesVisible { |
| 277 [appsSearchBoxController_ clearSearch]; |
| 278 } |
| 279 |
272 - (app_list::SearchBoxModel*)searchBoxModel { | 280 - (app_list::SearchBoxModel*)searchBoxModel { |
273 app_list::AppListModel* appListModel = [appsGridController_ model]; | 281 app_list::AppListModel* appListModel = [appsGridController_ model]; |
274 return appListModel ? appListModel->search_box() : NULL; | 282 return appListModel ? appListModel->search_box() : NULL; |
275 } | 283 } |
276 | 284 |
277 - (app_list::AppListViewDelegate*)appListDelegate { | 285 - (app_list::AppListViewDelegate*)appListDelegate { |
278 return [self delegate]; | 286 return [self delegate]; |
279 } | 287 } |
280 | 288 |
281 - (BOOL)control:(NSControl*)control | 289 - (BOOL)control:(NSControl*)control |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 330 |
323 - (void)openResult:(app_list::SearchResult*)result { | 331 - (void)openResult:(app_list::SearchResult*)result { |
324 if (delegate_) | 332 if (delegate_) |
325 delegate_->OpenSearchResult(result, 0 /* event flags */); | 333 delegate_->OpenSearchResult(result, 0 /* event flags */); |
326 } | 334 } |
327 | 335 |
328 - (void)redoSearch { | 336 - (void)redoSearch { |
329 [self modelTextDidChange]; | 337 [self modelTextDidChange]; |
330 } | 338 } |
331 | 339 |
| 340 - (void)invokeResultAction:(app_list::SearchResult*)result |
| 341 atIndex:(int)actionIndex { |
| 342 if (delegate_) { |
| 343 delegate_->InvokeSearchResultAction(result, |
| 344 actionIndex, |
| 345 0 /* event flags */); |
| 346 } |
| 347 } |
| 348 |
332 - (void)onProfilesChanged { | 349 - (void)onProfilesChanged { |
333 [appsSearchBoxController_ rebuildMenu]; | 350 [appsSearchBoxController_ rebuildMenu]; |
334 app_list::SigninDelegate* signinDelegate = | 351 app_list::SigninDelegate* signinDelegate = |
335 delegate_ ? delegate_->GetSigninDelegate() : NULL; | 352 delegate_ ? delegate_->GetSigninDelegate() : NULL; |
336 BOOL showSigninView = signinDelegate && signinDelegate->NeedSignin(); | 353 BOOL showSigninView = signinDelegate && signinDelegate->NeedSignin(); |
337 | 354 |
338 [[signinViewController_ view] removeFromSuperview]; | 355 [[signinViewController_ view] removeFromSuperview]; |
339 signinViewController_.reset(); | 356 signinViewController_.reset(); |
340 | 357 |
341 if (!showSigninView) { | 358 if (!showSigninView) { |
342 [backgroundView_ setHidden:NO]; | 359 [backgroundView_ setHidden:NO]; |
343 return; | 360 return; |
344 } | 361 } |
345 | 362 |
346 [backgroundView_ setHidden:YES]; | 363 [backgroundView_ setHidden:YES]; |
347 signinViewController_.reset( | 364 signinViewController_.reset( |
348 [[SigninViewController alloc] initWithFrame:[backgroundView_ frame] | 365 [[SigninViewController alloc] initWithFrame:[backgroundView_ frame] |
349 cornerRadius:kBubbleCornerRadius | 366 cornerRadius:kBubbleCornerRadius |
350 delegate:signinDelegate]); | 367 delegate:signinDelegate]); |
351 [[self view] addSubview:[signinViewController_ view]]; | 368 [[self view] addSubview:[signinViewController_ view]]; |
352 } | 369 } |
353 | 370 |
354 @end | 371 @end |
OLD | NEW |