| 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/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 - (NSSegmentedControl*)pagerControl { | 148 - (NSSegmentedControl*)pagerControl { |
| 149 return pagerControl_; | 149 return pagerControl_; |
| 150 } | 150 } |
| 151 | 151 |
| 152 - (NSView*)backgroundView { | 152 - (NSView*)backgroundView { |
| 153 return backgroundView_; | 153 return backgroundView_; |
| 154 } | 154 } |
| 155 | 155 |
| 156 - (app_list::AppListViewDelegate*)delegate { | 156 - (app_list::AppListViewDelegate*)delegate { |
| 157 return delegate_.get(); | 157 return delegate_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 - (void)setDelegate:(scoped_ptr<app_list::AppListViewDelegate>)newDelegate { | 160 - (void)setDelegate:(app_list::AppListViewDelegate*)newDelegate { |
| 161 if (delegate_) { | 161 if (delegate_) { |
| 162 // Ensure the search box is cleared when switching profiles. | 162 // Ensure the search box is cleared when switching profiles. |
| 163 if ([self searchBoxModel]) | 163 if ([self searchBoxModel]) |
| 164 [self searchBoxModel]->SetText(base::string16()); | 164 [self searchBoxModel]->SetText(base::string16()); |
| 165 | 165 |
| 166 // First clean up, in reverse order. | 166 // First clean up, in reverse order. |
| 167 app_list_model_observer_bridge_.reset(); | 167 app_list_model_observer_bridge_.reset(); |
| 168 [appsSearchResultsController_ setDelegate:nil]; | 168 [appsSearchResultsController_ setDelegate:nil]; |
| 169 [appsSearchBoxController_ setDelegate:nil]; | 169 [appsSearchBoxController_ setDelegate:nil]; |
| 170 [appsGridController_ setDelegate:nil]; | 170 [appsGridController_ setDelegate:nil]; |
| 171 } | 171 } |
| 172 delegate_.reset(newDelegate.release()); | 172 delegate_ = newDelegate; |
| 173 if (delegate_) { | 173 if (delegate_) { |
| 174 [loadingIndicator_ stopAnimation:self]; | 174 [loadingIndicator_ stopAnimation:self]; |
| 175 } else { | 175 } else { |
| 176 [loadingIndicator_ startAnimation:self]; | 176 [loadingIndicator_ startAnimation:self]; |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| 180 [appsGridController_ setDelegate:delegate_.get()]; | 180 [appsGridController_ setDelegate:delegate_]; |
| 181 [appsSearchBoxController_ setDelegate:self]; | 181 [appsSearchBoxController_ setDelegate:self]; |
| 182 [appsSearchResultsController_ setDelegate:self]; | 182 [appsSearchResultsController_ setDelegate:self]; |
| 183 app_list_model_observer_bridge_.reset( | 183 app_list_model_observer_bridge_.reset( |
| 184 new app_list::AppListModelObserverBridge(self)); | 184 new app_list::AppListModelObserverBridge(self)); |
| 185 [self onProfilesChanged]; | 185 [self onProfilesChanged]; |
| 186 } | 186 } |
| 187 | 187 |
| 188 -(void)loadAndSetView { | 188 -(void)loadAndSetView { |
| 189 pagerControl_.reset([[AppListPagerView alloc] init]); | 189 pagerControl_.reset([[AppListPagerView alloc] init]); |
| 190 [pagerControl_ setTarget:appsGridController_]; | 190 [pagerControl_ setTarget:appsGridController_]; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 - (void)redoSearch { | 359 - (void)redoSearch { |
| 360 [self modelTextDidChange]; | 360 [self modelTextDidChange]; |
| 361 } | 361 } |
| 362 | 362 |
| 363 - (void)onProfilesChanged { | 363 - (void)onProfilesChanged { |
| 364 [appsSearchBoxController_ rebuildMenu]; | 364 [appsSearchBoxController_ rebuildMenu]; |
| 365 } | 365 } |
| 366 | 366 |
| 367 @end | 367 @end |
| OLD | NEW |