Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/browser/ui/gtk/infobars/infobar_gtk.cc

Issue 6932002: gtk/infobars: Refactor AnimateOpen/Open into a single Show() method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/infobars/infobar_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698