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

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

Issue 63283003: Move AppListModel::Users to AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fixes Created 7 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 | 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/apps_search_box_controller.h" 5 #import "ui/app_list/cocoa/apps_search_box_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 - (void)clearSearch { 153 - (void)clearSearch {
154 [searchTextField_ setStringValue:@""]; 154 [searchTextField_ setStringValue:@""];
155 [self controlTextDidChange:nil]; 155 [self controlTextDidChange:nil];
156 } 156 }
157 157
158 - (void)rebuildMenu { 158 - (void)rebuildMenu {
159 if (![delegate_ appListDelegate]) 159 if (![delegate_ appListDelegate])
160 return; 160 return;
161 161
162 menuController_.reset(); 162 menuController_.reset();
163 appListMenu_.reset( 163 appListMenu_.reset(new app_list::AppListMenu([delegate_ appListDelegate]));
164 new app_list::AppListMenu([delegate_ appListDelegate],
165 [delegate_ appListModel]->users()));
166 menuController_.reset([[AppListMenuController alloc] 164 menuController_.reset([[AppListMenuController alloc]
167 initWithSearchBoxController:self]); 165 initWithSearchBoxController:self]);
168 [menuButton_ setMenu:[menuController_ menu]]; // Menu will populate here. 166 [menuButton_ setMenu:[menuController_ menu]]; // Menu will populate here.
169 } 167 }
170 168
171 - (void)setDelegate:(id<AppsSearchBoxDelegate>)delegate { 169 - (void)setDelegate:(id<AppsSearchBoxDelegate>)delegate {
172 [[menuButton_ menu] removeAllItems]; 170 [[menuButton_ menu] removeAllItems];
173 menuController_.reset(); 171 menuController_.reset();
174 appListMenu_.reset(); 172 appListMenu_.reset();
175 bridge_.reset(); // Ensure observers are cleared before updating |delegate_|. 173 bridge_.reset(); // Ensure observers are cleared before updating |delegate_|.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( 380 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint(
383 NSMaxX(anchorRect) + kMenuXOffsetFromButton, 381 NSMaxX(anchorRect) + kMenuXOffsetFromButton,
384 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; 382 NSMinY(anchorRect) - kMenuYOffsetFromButton)];
385 NSRect confinementRect = [[menuButton window] frame]; 383 NSRect confinementRect = [[menuButton window] frame];
386 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), 384 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect),
387 anchorPoint.y - NSMinY(confinementRect)); 385 anchorPoint.y - NSMinY(confinementRect));
388 return confinementRect; 386 return confinementRect;
389 } 387 }
390 388
391 @end 389 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698