OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/mac_util.h" | 6 #include "base/mac/mac_util.h" |
7 #include "chrome/browser/tab_contents/infobar_delegate.h" | 7 #include "chrome/browser/tab_contents/infobar_delegate.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
9 #import "chrome/browser/ui/cocoa/animatable_view.h" | 9 #import "chrome/browser/ui/cocoa/animatable_view.h" |
10 #include "chrome/browser/ui/cocoa/infobar.h" | 10 #include "chrome/browser/ui/cocoa/infobar.h" |
11 #import "chrome/browser/ui/cocoa/infobar_container_controller.h" | 11 #import "chrome/browser/ui/cocoa/infobar_container_controller.h" |
12 #import "chrome/browser/ui/cocoa/infobar_controller.h" | 12 #import "chrome/browser/ui/cocoa/infobar_controller.h" |
13 #import "chrome/browser/ui/cocoa/view_id_util.h" | 13 #import "chrome/browser/ui/cocoa/view_id_util.h" |
14 #include "chrome/common/notification_details.h" | 14 #include "chrome/common/notification_details.h" |
15 #include "chrome/common/notification_source.h" | 15 #include "chrome/common/notification_source.h" |
16 #include "skia/ext/skia_utils_mac.h" | 16 #include "skia/ext/skia_utils_mac.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // adding together the heights of all its subviews. | 64 // adding together the heights of all its subviews. |
65 - (CGFloat)desiredHeight; | 65 - (CGFloat)desiredHeight; |
66 | 66 |
67 @end | 67 @end |
68 | 68 |
69 | 69 |
70 @implementation InfoBarContainerController | 70 @implementation InfoBarContainerController |
71 - (id)initWithResizeDelegate:(id<ViewResizer>)resizeDelegate { | 71 - (id)initWithResizeDelegate:(id<ViewResizer>)resizeDelegate { |
72 DCHECK(resizeDelegate); | 72 DCHECK(resizeDelegate); |
73 if ((self = [super initWithNibName:@"InfoBarContainer" | 73 if ((self = [super initWithNibName:@"InfoBarContainer" |
74 bundle:mac_util::MainAppBundle()])) { | 74 bundle:base::mac::MainAppBundle()])) { |
75 resizeDelegate_ = resizeDelegate; | 75 resizeDelegate_ = resizeDelegate; |
76 infoBarObserver_.reset(new InfoBarNotificationObserver(self)); | 76 infoBarObserver_.reset(new InfoBarNotificationObserver(self)); |
77 | 77 |
78 // NSMutableArray needs an initial capacity, and we rarely ever see | 78 // NSMutableArray needs an initial capacity, and we rarely ever see |
79 // more than two infobars at a time, so that seems like a good choice. | 79 // more than two infobars at a time, so that seems like a good choice. |
80 infobarControllers_.reset([[NSMutableArray alloc] initWithCapacity:2]); | 80 infobarControllers_.reset([[NSMutableArray alloc] initWithCapacity:2]); |
81 } | 81 } |
82 return self; | 82 return self; |
83 } | 83 } |
84 | 84 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 frame.size.width = NSWidth(containerBounds); | 220 frame.size.width = NSWidth(containerBounds); |
221 frame.origin.y = minY; | 221 frame.origin.y = minY; |
222 minY += frame.size.height; | 222 minY += frame.size.height; |
223 [view setFrame:frame]; | 223 [view setFrame:frame]; |
224 } | 224 } |
225 | 225 |
226 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; | 226 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |
227 } | 227 } |
228 | 228 |
229 @end | 229 @end |
OLD | NEW |