| 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" |
| 11 #import "chrome/browser/ui/cocoa/animatable_view.h" | 11 #import "chrome/browser/ui/cocoa/animatable_view.h" |
| 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 13 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 13 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" | 14 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
| 15 #import "chrome/browser/ui/cocoa/view_id_util.h" | 15 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/public/browser/notification_details.h" | 17 #include "content/public/browser/notification_details.h" |
| 18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 19 #include "skia/ext/skia_utils_mac.h" | 19 #include "skia/ext/skia_utils_mac.h" |
| 20 | 20 |
| 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 explicit 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 void Observe(int type, |
| 32 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
| 33 const content::NotificationDetails& details) { | 33 const content::NotificationDetails& details) { |
| 34 InfoBarService* infobar_service = | 34 InfoBarService* infobar_service = |
| 35 content::Source<InfoBarService>(source).ptr(); | 35 content::Source<InfoBarService>(source).ptr(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 frame.size.width = NSWidth(containerBounds); | 268 frame.size.width = NSWidth(containerBounds); |
| 269 [view setFrame:frame]; | 269 [view setFrame:frame]; |
| 270 | 270 |
| 271 minY += NSHeight(frame) - infobars::kTipHeight; | 271 minY += NSHeight(frame) - infobars::kTipHeight; |
| 272 } | 272 } |
| 273 | 273 |
| 274 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; | 274 [resizeDelegate_ resizeView:[self view] newHeight:[self desiredHeight]]; |
| 275 } | 275 } |
| 276 | 276 |
| 277 @end | 277 @end |
| OLD | NEW |