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

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

Issue 593563002: For Mac, add AppListViewDelegateObserver::OnShutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cl format, nits Created 6 years, 2 months 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
« no previous file with comments | « ui/app_list/app_list_view_delegate_observer.h ('k') | ui/app_list/views/app_list_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « ui/app_list/app_list_view_delegate_observer.h ('k') | ui/app_list/views/app_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698