OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bundle_locations.h" | 6 #include "base/mac/bundle_locations.h" |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
9 #include "chrome/browser/api/infobars/infobar_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // C++ class that receives INFOBAR_ADDED and INFOBAR_REMOVED | 21 // C++ class that receives INFOBAR_ADDED and INFOBAR_REMOVED |
22 // notifications and proxies them back to |controller|. | 22 // notifications and proxies them back to |controller|. |
23 class InfoBarNotificationObserver : public content::NotificationObserver { | 23 class InfoBarNotificationObserver : public content::NotificationObserver { |
24 public: | 24 public: |
25 InfoBarNotificationObserver(InfoBarContainerController* controller) | 25 InfoBarNotificationObserver(InfoBarContainerController* controller) |
26 : controller_(controller) { | 26 : controller_(controller) { |
27 } | 27 } |
28 | 28 |
29 private: | 29 private: |
30 // NotificationObserver implementation | 30 // NotificationObserver implementation |
31 void Observe(int type, | 31 virtual void Observe( |
32 const content::NotificationSource& source, | 32 int type, |
33 const content::NotificationDetails& details) { | 33 const content::NotificationSource& source, |
| 34 const content::NotificationDetails& details) OVERRIDE { |
34 InfoBarService* infobar_service = | 35 InfoBarService* infobar_service = |
35 content::Source<InfoBarService>(source).ptr(); | 36 content::Source<InfoBarService>(source).ptr(); |
36 switch (type) { | 37 switch (type) { |
37 case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED: | 38 case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED: |
38 [controller_ addInfoBar:content::Details<InfoBarAddedDetails>(details)-> | 39 [controller_ addInfoBar:content::Details<InfoBarAddedDetails>(details)-> |
39 CreateInfoBar(infobar_service) | 40 CreateInfoBar(infobar_service) |
40 animate:YES]; | 41 animate:YES]; |
41 break; | 42 break; |
42 | 43 |
43 case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED: { | 44 case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED: { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 frame.size.width = NSWidth(containerBounds); | 269 frame.size.width = NSWidth(containerBounds); |
269 [view setFrame:frame]; | 270 [view setFrame:frame]; |
270 | 271 |
271 minY += NSHeight(frame) - infobars::kTipHeight; | 272 minY += NSHeight(frame) - infobars::kTipHeight; |
272 } | 273 } |
273 | 274 |
274 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; | 275 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |
275 } | 276 } |
276 | 277 |
277 @end | 278 @end |
OLD | NEW |