| OLD | NEW |
| 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/no_tabs/no_tabs_controller.h" | 5 #import "ios/chrome/browser/ui/no_tabs/no_tabs_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/objc_property_releaser.h" | 8 #include "base/mac/objc_release_properties.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "ios/chrome/browser/ui/background_generator.h" | 10 #import "ios/chrome/browser/ui/background_generator.h" |
| 11 #import "ios/chrome/browser/ui/no_tabs/no_tabs_controller_testing.h" | 11 #import "ios/chrome/browser/ui/no_tabs/no_tabs_controller_testing.h" |
| 12 #import "ios/chrome/browser/ui/no_tabs/no_tabs_toolbar_controller.h" | 12 #import "ios/chrome/browser/ui/no_tabs/no_tabs_toolbar_controller.h" |
| 13 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" | 13 #import "ios/chrome/browser/ui/toolbar/toolbar_controller.h" |
| 14 #import "ios/chrome/browser/ui/tools_menu/tools_menu_context.h" | 14 #import "ios/chrome/browser/ui/tools_menu/tools_menu_context.h" |
| 15 #include "ios/chrome/browser/ui/ui_util.h" | 15 #include "ios/chrome/browser/ui/ui_util.h" |
| 16 | 16 |
| 17 @interface NoTabsController (PrivateMethods) | 17 @interface NoTabsController (PrivateMethods) |
| 18 // Creates and installs the toolbar for the No-Tabs UI. | 18 // Creates and installs the toolbar for the No-Tabs UI. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 // The background view behind the No-Tabs UI. | 37 // The background view behind the No-Tabs UI. |
| 38 base::scoped_nsobject<UIView> backgroundView_; | 38 base::scoped_nsobject<UIView> backgroundView_; |
| 39 | 39 |
| 40 // The image view used to animate the mode toggle button when entering or | 40 // The image view used to animate the mode toggle button when entering or |
| 41 // leaving the No-Tabs UI. | 41 // leaving the No-Tabs UI. |
| 42 base::scoped_nsobject<UIImageView> modeToggleImageView_; | 42 base::scoped_nsobject<UIImageView> modeToggleImageView_; |
| 43 | 43 |
| 44 // The ending frame for the mode toggle button animation. Equal to CGRectZero | 44 // The ending frame for the mode toggle button animation. Equal to CGRectZero |
| 45 // if the mode toggle button is not being animated. | 45 // if the mode toggle button is not being animated. |
| 46 CGRect toggleImageEndFrame_; | 46 CGRect toggleImageEndFrame_; |
| 47 | |
| 48 base::mac::ObjCPropertyReleaser propertyReleaser_NoTabsController_; | |
| 49 } | 47 } |
| 50 | 48 |
| 51 // Designated initializer. | 49 // Designated initializer. |
| 52 - (id)initWithView:(UIView*)view { | 50 - (id)initWithView:(UIView*)view { |
| 53 self = [super init]; | 51 self = [super init]; |
| 54 if (self) { | 52 if (self) { |
| 55 propertyReleaser_NoTabsController_.Init(self, [NoTabsController class]); | |
| 56 | |
| 57 parentView_ = view; | 53 parentView_ = view; |
| 58 [self installNoTabsToolbarInView:view]; | 54 [self installNoTabsToolbarInView:view]; |
| 59 [self installNoTabsBackgroundInView:view]; | 55 [self installNoTabsBackgroundInView:view]; |
| 60 } | 56 } |
| 61 return self; | 57 return self; |
| 62 } | 58 } |
| 63 | 59 |
| 60 - (void)dealloc { |
| 61 base::mac::ReleaseProperties(self); |
| 62 [super dealloc]; |
| 63 } |
| 64 |
| 64 // Passes the call through to the toolbar controller. | 65 // Passes the call through to the toolbar controller. |
| 65 - (void)setHasModeToggleSwitch:(BOOL)hasModeToggle { | 66 - (void)setHasModeToggleSwitch:(BOOL)hasModeToggle { |
| 66 [toolbarController_ setHasModeToggleSwitch:hasModeToggle]; | 67 [toolbarController_ setHasModeToggleSwitch:hasModeToggle]; |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Prepares the given button for animation. | 70 // Prepares the given button for animation. |
| 70 - (void)installAnimationImageForButton:(UIButton*)button | 71 - (void)installAnimationImageForButton:(UIButton*)button |
| 71 inView:(UIView*)view | 72 inView:(UIView*)view |
| 72 show:(BOOL)show { | 73 show:(BOOL)show { |
| 73 UIButton* fromButton = nil; | 74 UIButton* fromButton = nil; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 205 } |
| 205 | 206 |
| 206 - (UIView*)toolbarView { | 207 - (UIView*)toolbarView { |
| 207 return [toolbarController_ view]; | 208 return [toolbarController_ view]; |
| 208 } | 209 } |
| 209 | 210 |
| 210 - (UIView*)backgroundView { | 211 - (UIView*)backgroundView { |
| 211 return backgroundView_.get(); | 212 return backgroundView_.get(); |
| 212 } | 213 } |
| 213 @end | 214 @end |
| OLD | NEW |