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/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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
164 new app_list::AppListMenu([delegate_ appListDelegate], | 164 new app_list::AppListMenu([delegate_ appListDelegate])); |
165 [delegate_ appListModel]->users())); | |
166 menuController_.reset([[AppListMenuController alloc] | 165 menuController_.reset([[AppListMenuController alloc] |
167 initWithSearchBoxController:self]); | 166 initWithSearchBoxController:self]); |
168 [menuButton_ setMenu:[menuController_ menu]]; // Menu will populate here. | 167 [menuButton_ setMenu:[menuController_ menu]]; // Menu will populate here. |
169 } | 168 } |
170 | 169 |
171 - (void)setDelegate:(id<AppsSearchBoxDelegate>)delegate { | 170 - (void)setDelegate:(id<AppsSearchBoxDelegate>)delegate { |
172 [[menuButton_ menu] removeAllItems]; | 171 [[menuButton_ menu] removeAllItems]; |
173 menuController_.reset(); | 172 menuController_.reset(); |
174 appListMenu_.reset(); | 173 appListMenu_.reset(); |
175 bridge_.reset(); // Ensure observers are cleared before updating |delegate_|. | 174 bridge_.reset(); // Ensure observers are cleared before updating |delegate_|. |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( | 381 NSPoint anchorPoint = [[menuButton window] convertBaseToScreen:NSMakePoint( |
383 NSMaxX(anchorRect) + kMenuXOffsetFromButton, | 382 NSMaxX(anchorRect) + kMenuXOffsetFromButton, |
384 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; | 383 NSMinY(anchorRect) - kMenuYOffsetFromButton)]; |
385 NSRect confinementRect = [[menuButton window] frame]; | 384 NSRect confinementRect = [[menuButton window] frame]; |
386 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), | 385 confinementRect.size = NSMakeSize(anchorPoint.x - NSMinX(confinementRect), |
387 anchorPoint.y - NSMinY(confinementRect)); | 386 anchorPoint.y - NSMinY(confinementRect)); |
388 return confinementRect; | 387 return confinementRect; |
389 } | 388 } |
390 | 389 |
391 @end | 390 @end |
OLD | NEW |