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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 namespace app_list { | 81 namespace app_list { |
82 | 82 |
83 class AppListModelObserverBridge : public AppListViewDelegateObserver { | 83 class AppListModelObserverBridge : public AppListViewDelegateObserver { |
84 public: | 84 public: |
85 AppListModelObserverBridge(AppListViewController* parent); | 85 AppListModelObserverBridge(AppListViewController* parent); |
86 virtual ~AppListModelObserverBridge(); | 86 virtual ~AppListModelObserverBridge(); |
87 | 87 |
88 private: | 88 private: |
89 // Overridden from app_list::AppListViewDelegateObserver: | 89 // Overridden from app_list::AppListViewDelegateObserver: |
90 virtual void OnProfilesChanged() OVERRIDE; | 90 virtual void OnProfilesChanged() OVERRIDE; |
| 91 virtual void OnShutdown() OVERRIDE; |
91 | 92 |
92 AppListViewController* parent_; // Weak. Owns us. | 93 AppListViewController* parent_; // Weak. Owns us. |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(AppListModelObserverBridge); | 95 DISALLOW_COPY_AND_ASSIGN(AppListModelObserverBridge); |
95 }; | 96 }; |
96 | 97 |
97 AppListModelObserverBridge::AppListModelObserverBridge( | 98 AppListModelObserverBridge::AppListModelObserverBridge( |
98 AppListViewController* parent) | 99 AppListViewController* parent) |
99 : parent_(parent) { | 100 : parent_(parent) { |
100 [parent_ delegate]->AddObserver(this); | 101 [parent_ delegate]->AddObserver(this); |
101 } | 102 } |
102 | 103 |
103 AppListModelObserverBridge::~AppListModelObserverBridge() { | 104 AppListModelObserverBridge::~AppListModelObserverBridge() { |
104 [parent_ delegate]->RemoveObserver(this); | 105 [parent_ delegate]->RemoveObserver(this); |
105 } | 106 } |
106 | 107 |
107 void AppListModelObserverBridge::OnProfilesChanged() { | 108 void AppListModelObserverBridge::OnProfilesChanged() { |
108 [parent_ onProfilesChanged]; | 109 [parent_ onProfilesChanged]; |
109 } | 110 } |
110 | 111 |
| 112 void AppListModelObserverBridge::OnShutdown() { |
| 113 [parent_ setDelegate:nil]; |
| 114 } |
| 115 |
111 } // namespace app_list | 116 } // namespace app_list |
112 | 117 |
113 @implementation AppListViewController | 118 @implementation AppListViewController |
114 | 119 |
115 - (id)init { | 120 - (id)init { |
116 if ((self = [super init])) { | 121 if ((self = [super init])) { |
117 appsGridController_.reset([[AppsGridController alloc] init]); | 122 appsGridController_.reset([[AppsGridController alloc] init]); |
118 [self loadAndSetView]; | 123 [self loadAndSetView]; |
119 | 124 |
120 [self totalPagesChanged]; | 125 [self totalPagesChanged]; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 363 |
359 - (void)redoSearch { | 364 - (void)redoSearch { |
360 [self modelTextDidChange]; | 365 [self modelTextDidChange]; |
361 } | 366 } |
362 | 367 |
363 - (void)onProfilesChanged { | 368 - (void)onProfilesChanged { |
364 [appsSearchBoxController_ rebuildMenu]; | 369 [appsSearchBoxController_ rebuildMenu]; |
365 } | 370 } |
366 | 371 |
367 @end | 372 @end |
OLD | NEW |