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

Side by Side Diff: ios/chrome/browser/ui/ntp/new_tab_page_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Yank unrelated changes. Created 3 years, 10 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #import "base/ios/weak_nsobject.h" 9 #import "base/ios/weak_nsobject.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/objc_property_releaser.h" 11 #include "base/mac/objc_release_properties.h"
12 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
13 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
14 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
15 #include "components/search_engines/template_url_service.h" 15 #include "components/search_engines/template_url_service.h"
16 #include "components/strings/grit/components_strings.h" 16 #include "components/strings/grit/components_strings.h"
17 #include "components/sync_sessions/synced_session.h" 17 #include "components/sync_sessions/synced_session.h"
18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
19 #include "ios/chrome/browser/pref_names.h" 19 #include "ios/chrome/browser/pref_names.h"
20 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 20 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
21 #include "ios/chrome/browser/sync/sync_setup_service.h" 21 #include "ios/chrome/browser/sync/sync_setup_service.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Dominant color cache. Key: (NSString*)url, val: (UIColor*)dominantColor. 120 // Dominant color cache. Key: (NSString*)url, val: (UIColor*)dominantColor.
121 NSMutableDictionary* dominantColorCache_; // Weak, owned by bvc. 121 NSMutableDictionary* dominantColorCache_; // Weak, owned by bvc.
122 122
123 // Delegate to focus and blur the omnibox. 123 // Delegate to focus and blur the omnibox.
124 base::WeakNSProtocol<id<OmniboxFocuser>> focuser_; 124 base::WeakNSProtocol<id<OmniboxFocuser>> focuser_;
125 125
126 // Delegate to fetch the ToolbarModel and current web state from. 126 // Delegate to fetch the ToolbarModel and current web state from.
127 base::WeakNSProtocol<id<WebToolbarDelegate>> webToolbarDelegate_; 127 base::WeakNSProtocol<id<WebToolbarDelegate>> webToolbarDelegate_;
128 128
129 base::scoped_nsobject<TabModel> tabModel_; 129 base::scoped_nsobject<TabModel> tabModel_;
130
131 base::mac::ObjCPropertyReleaser propertyReleaser_NewTabPageController_;
132 } 130 }
133 131
134 // Load and bring panel into view. 132 // Load and bring panel into view.
135 - (void)showPanel:(NewTabPageBarItem*)item; 133 - (void)showPanel:(NewTabPageBarItem*)item;
136 // Load panel on demand. 134 // Load panel on demand.
137 - (BOOL)loadPanel:(NewTabPageBarItem*)item; 135 - (BOOL)loadPanel:(NewTabPageBarItem*)item;
138 // After a panel changes, update metrics and prefs information. 136 // After a panel changes, update metrics and prefs information.
139 - (void)panelChanged:(NewTabPageBarItem*)item; 137 - (void)panelChanged:(NewTabPageBarItem*)item;
140 // Update current controller and tab bar index. Used to call reload. 138 // Update current controller and tab bar index. Used to call reload.
141 - (void)updateCurrentController:(NewTabPageBarItem*)item 139 - (void)updateCurrentController:(NewTabPageBarItem*)item
(...skipping 27 matching lines...) Expand all
169 loader:(id<UrlLoader>)loader 167 loader:(id<UrlLoader>)loader
170 focuser:(id<OmniboxFocuser>)focuser 168 focuser:(id<OmniboxFocuser>)focuser
171 ntpObserver:(id<NewTabPageControllerObserver>)ntpObserver 169 ntpObserver:(id<NewTabPageControllerObserver>)ntpObserver
172 browserState:(ios::ChromeBrowserState*)browserState 170 browserState:(ios::ChromeBrowserState*)browserState
173 colorCache:(NSMutableDictionary*)colorCache 171 colorCache:(NSMutableDictionary*)colorCache
174 webToolbarDelegate:(id<WebToolbarDelegate>)webToolbarDelegate 172 webToolbarDelegate:(id<WebToolbarDelegate>)webToolbarDelegate
175 tabModel:(TabModel*)tabModel { 173 tabModel:(TabModel*)tabModel {
176 self = [super initWithNibName:nil url:url]; 174 self = [super initWithNibName:nil url:url];
177 if (self) { 175 if (self) {
178 DCHECK(browserState); 176 DCHECK(browserState);
179 propertyReleaser_NewTabPageController_.Init(self,
180 [NewTabPageController class]);
181 browserState_ = browserState; 177 browserState_ = browserState;
182 loader_ = loader; 178 loader_ = loader;
183 newTabPageObserver_ = ntpObserver; 179 newTabPageObserver_ = ntpObserver;
184 focuser_.reset(focuser); 180 focuser_.reset(focuser);
185 webToolbarDelegate_.reset(webToolbarDelegate); 181 webToolbarDelegate_.reset(webToolbarDelegate);
186 tabModel_.reset([tabModel retain]); 182 tabModel_.reset([tabModel retain]);
187 dominantColorCache_ = colorCache; 183 dominantColorCache_ = colorCache;
188 self.title = l10n_util::GetNSString(IDS_NEW_TAB_TITLE); 184 self.title = l10n_util::GetNSString(IDS_NEW_TAB_TITLE);
189 scrollInitialized_ = NO; 185 scrollInitialized_ = NO;
190 186
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 271 }
276 272
277 - (void)dealloc { 273 - (void)dealloc {
278 // Animations can last past the life of the NTP controller, nil out the 274 // Animations can last past the life of the NTP controller, nil out the
279 // delegate. 275 // delegate.
280 self.ntpView.scrollView.delegate = nil; 276 self.ntpView.scrollView.delegate = nil;
281 [googleLandingController_ setDelegate:nil]; 277 [googleLandingController_ setDelegate:nil];
282 [bookmarkController_ setDelegate:nil]; 278 [bookmarkController_ setDelegate:nil];
283 [openTabsController_ setDelegate:nil]; 279 [openTabsController_ setDelegate:nil];
284 [[NSNotificationCenter defaultCenter] removeObserver:self]; 280 [[NSNotificationCenter defaultCenter] removeObserver:self];
281 base::mac::ReleaseProperties(self);
285 [super dealloc]; 282 [super dealloc];
286 } 283 }
287 284
288 #pragma mark - CRWNativeContent 285 #pragma mark - CRWNativeContent
289 286
290 // Note: No point implementing -handleLowMemory because all native content 287 // Note: No point implementing -handleLowMemory because all native content
291 // views but the selected one are dropped, and the selected view doesn't 288 // views but the selected one are dropped, and the selected view doesn't
292 // need to do anything. 289 // need to do anything.
293 290
294 - (void)reload { 291 - (void)reload {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 673
677 - (void)updateNtpBarShadowForPanelController: 674 - (void)updateNtpBarShadowForPanelController:
678 (id<NewTabPagePanelProtocol>)ntpPanelController { 675 (id<NewTabPagePanelProtocol>)ntpPanelController {
679 if (currentController_ != ntpPanelController) 676 if (currentController_ != ntpPanelController)
680 return; 677 return;
681 [self.ntpView.tabBar 678 [self.ntpView.tabBar
682 setShadowAlpha:[ntpPanelController alphaForBottomShadow]]; 679 setShadowAlpha:[ntpPanelController alphaForBottomShadow]];
683 } 680 }
684 681
685 @end 682 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698