| 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 "chrome/browser/ui/views/infobars/infobar_container.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_container.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/tab_contents/infobar_delegate.h" | 9 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 tc_source); | 45 tc_source); |
| 46 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, | 46 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, |
| 47 tc_source); | 47 tc_source); |
| 48 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, | 48 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, |
| 49 tc_source); | 49 tc_source); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 void InfoBarContainer::InfoBarAnimated(bool completed) { | 53 void InfoBarContainer::InfoBarAnimated(bool completed) { |
| 54 if (delegate_) | 54 if (delegate_) |
| 55 delegate_->InfoBarSizeChanged(!completed); | 55 delegate_->InfoBarContainerSizeChanged(!completed); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { | 58 void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { |
| 59 tab_contents_->RemoveInfoBar(delegate); | 59 tab_contents_->RemoveInfoBar(delegate); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // InfoBarContainer, views::View overrides: ------------------------------------ | 62 // InfoBarContainer, views::View overrides: ------------------------------------ |
| 63 | 63 |
| 64 gfx::Size InfoBarContainer::GetPreferredSize() { | 64 gfx::Size InfoBarContainer::GetPreferredSize() { |
| 65 // We do not have a preferred width (we will expand to fit the available width | 65 // We do not have a preferred width (we will expand to fit the available width |
| (...skipping 19 matching lines...) Expand all Loading... |
| 85 return AccessibilityTypes::ROLE_GROUPING; | 85 return AccessibilityTypes::ROLE_GROUPING; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void InfoBarContainer::ViewHierarchyChanged(bool is_add, | 88 void InfoBarContainer::ViewHierarchyChanged(bool is_add, |
| 89 views::View* parent, | 89 views::View* parent, |
| 90 views::View* child) { | 90 views::View* child) { |
| 91 if (parent == this && child->GetParent() == this) { | 91 if (parent == this && child->GetParent() == this) { |
| 92 if (delegate_) { | 92 if (delegate_) { |
| 93 // An InfoBar child was added or removed. Tell the delegate it needs to | 93 // An InfoBar child was added or removed. Tell the delegate it needs to |
| 94 // re-layout since our preferred size will have changed. | 94 // re-layout since our preferred size will have changed. |
| 95 delegate_->InfoBarSizeChanged(false); | 95 delegate_->InfoBarContainerSizeChanged(false); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 // InfoBarContainer, NotificationObserver implementation: ---------------------- | 100 // InfoBarContainer, NotificationObserver implementation: ---------------------- |
| 101 | 101 |
| 102 void InfoBarContainer::Observe(NotificationType type, | 102 void InfoBarContainer::Observe(NotificationType type, |
| 103 const NotificationSource& source, | 103 const NotificationSource& source, |
| 104 const NotificationDetails& details) { | 104 const NotificationDetails& details) { |
| 105 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { | 105 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 break; | 158 break; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 void InfoBarContainer::ReplaceInfoBar(InfoBarDelegate* old_delegate, | 163 void InfoBarContainer::ReplaceInfoBar(InfoBarDelegate* old_delegate, |
| 164 InfoBarDelegate* new_delegate) { | 164 InfoBarDelegate* new_delegate) { |
| 165 RemoveInfoBar(old_delegate, false); // no animation | 165 RemoveInfoBar(old_delegate, false); // no animation |
| 166 AddInfoBar(new_delegate, false); // no animation | 166 AddInfoBar(new_delegate, false); // no animation |
| 167 } | 167 } |
| OLD | NEW |