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/gtk/infobars/infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 g_object_set_data(G_OBJECT(slide_widget_->widget()), "info-bar", this); | 88 g_object_set_data(G_OBJECT(slide_widget_->widget()), "info-bar", this); |
89 } | 89 } |
90 | 90 |
91 InfoBar::~InfoBar() { | 91 InfoBar::~InfoBar() { |
92 } | 92 } |
93 | 93 |
94 GtkWidget* InfoBar::widget() { | 94 GtkWidget* InfoBar::widget() { |
95 return slide_widget_->widget(); | 95 return slide_widget_->widget(); |
96 } | 96 } |
97 | 97 |
98 void InfoBar::AnimateOpen() { | 98 void InfoBar::Show(bool animate) { |
99 slide_widget_->Open(); | 99 if (animate) |
| 100 slide_widget_->Open(); |
| 101 else |
| 102 slide_widget_->OpenWithoutAnimation(); |
100 | 103 |
101 gtk_widget_show_all(bg_box_); | 104 gtk_widget_show_all(bg_box_); |
102 if (bg_box_->window) | 105 if (bg_box_->window) |
103 gdk_window_lower(bg_box_->window); | |
104 } | |
105 | |
106 void InfoBar::Open() { | |
107 slide_widget_->OpenWithoutAnimation(); | |
108 | |
109 gtk_widget_show_all(bg_box_); | |
110 if (bg_box_->window) | |
111 gdk_window_lower(bg_box_->window); | 106 gdk_window_lower(bg_box_->window); |
112 } | 107 } |
113 | 108 |
114 void InfoBar::AnimateClose() { | 109 void InfoBar::AnimateClose() { |
115 slide_widget_->Close(); | 110 slide_widget_->Close(); |
116 } | 111 } |
117 | 112 |
118 void InfoBar::Close() { | 113 void InfoBar::Close() { |
119 if (delegate_) { | 114 if (delegate_) { |
120 delegate_->InfoBarClosed(); | 115 delegate_->InfoBarClosed(); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 290 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
296 int x = browser_window ? | 291 int x = browser_window ? |
297 browser_window->GetXPositionOfLocationIcon(sender) : 0; | 292 browser_window->GetXPositionOfLocationIcon(sender) : 0; |
298 | 293 |
299 size_t size = InfoBarArrowModel::kDefaultArrowSize; | 294 size_t size = InfoBarArrowModel::kDefaultArrowSize; |
300 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size); | 295 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size); |
301 arrow_model_.Paint(sender, event, arrow_bounds, border_color); | 296 arrow_model_.Paint(sender, event, arrow_bounds, border_color); |
302 | 297 |
303 return FALSE; | 298 return FALSE; |
304 } | 299 } |
OLD | NEW |