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 "chrome/browser/gtk/infobar_container_gtk.h" | 5 #include "chrome/browser/gtk/infobar_container_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 // InfoBarContainerGtk, NotificationObserver implementation: ------------------- | 116 // InfoBarContainerGtk, NotificationObserver implementation: ------------------- |
117 | 117 |
118 void InfoBarContainerGtk::Observe(NotificationType type, | 118 void InfoBarContainerGtk::Observe(NotificationType type, |
119 const NotificationSource& source, | 119 const NotificationSource& source, |
120 const NotificationDetails& details) { | 120 const NotificationDetails& details) { |
121 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { | 121 if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { |
122 AddInfoBar(Details<InfoBarDelegate>(details).ptr(), true); | 122 AddInfoBar(Details<InfoBarDelegate>(details).ptr(), true); |
123 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) { | 123 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) { |
124 RemoveInfoBar(Details<InfoBarDelegate>(details).ptr(), true); | 124 RemoveInfoBar(Details<InfoBarDelegate>(details).ptr(), true); |
125 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED) { | 125 } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED) { |
126 std::pair<InfoBarDelegate*, InfoBarDelegate*>* delegates = | 126 typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> Delegates; |
127 Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> >(details).ptr(); | 127 Delegates* delegates = Details<Delegates>(details).ptr(); |
Evan Stade
2010/11/11 22:39:47
nit: can you call it DelegatePair?
Peter Kasting
2010/11/11 22:47:58
Good idea. Changed typedef and variable names her
| |
128 | 128 |
129 // By not animating the removal/addition, this appears to be a replace. | 129 // By not animating the removal/addition, this appears to be a replace. |
130 RemoveInfoBar(delegates->first, false); | 130 RemoveInfoBar(delegates->first, false); |
131 AddInfoBar(delegates->second, false); | 131 AddInfoBar(delegates->second, false); |
132 } else { | 132 } else { |
133 NOTREACHED(); | 133 NOTREACHED(); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 // InfoBarContainerGtk, private: ----------------------------------------------- | 137 // InfoBarContainerGtk, private: ----------------------------------------------- |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 } | 210 } |
211 | 211 |
212 void InfoBarContainerGtk::UpdateToolbarInfoBarState( | 212 void InfoBarContainerGtk::UpdateToolbarInfoBarState( |
213 InfoBar* infobar, bool animate) { | 213 InfoBar* infobar, bool animate) { |
214 GtkWindow* parent = platform_util::GetTopLevel(widget()); | 214 GtkWindow* parent = platform_util::GetTopLevel(widget()); |
215 BrowserWindowGtk* browser_window = | 215 BrowserWindowGtk* browser_window = |
216 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 216 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
217 if (browser_window) | 217 if (browser_window) |
218 browser_window->SetInfoBarShowing(infobar, animate); | 218 browser_window->SetInfoBarShowing(infobar, animate); |
219 } | 219 } |
OLD | NEW |