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

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

Issue 7130001: Make infobar background gray (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 6 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
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"
11 #include "chrome/browser/tab_contents/infobar.h"
11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 12 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
12 #include "chrome/browser/ui/gtk/custom_button.h" 13 #include "chrome/browser/ui/gtk/custom_button.h"
13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 14 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
15 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
16 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" 17 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h"
17 #include "content/common/notification_service.h" 18 #include "content/common/notification_service.h"
18 #include "ui/gfx/gtk_util.h" 19 #include "ui/gfx/gtk_util.h"
19 #include "ui/gfx/image.h" 20 #include "ui/gfx/image.h"
20 21
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 190
190 // We don't want any spacing between the elements, so we pack them into 191 // We don't want any spacing between the elements, so we pack them into
191 // this hbox that doesn't use kElementPadding. 192 // this hbox that doesn't use kElementPadding.
192 gtk_box_pack_start(GTK_BOX(hbox), initial_label, FALSE, FALSE, 0); 193 gtk_box_pack_start(GTK_BOX(hbox), initial_label, FALSE, FALSE, 0);
193 gtk_util::CenterWidgetInHBox(hbox, link_button, false, 0); 194 gtk_util::CenterWidgetInHBox(hbox, link_button, false, 0);
194 gtk_box_pack_start(GTK_BOX(hbox), trailing_label, FALSE, FALSE, 0); 195 gtk_box_pack_start(GTK_BOX(hbox), trailing_label, FALSE, FALSE, 0);
195 } 196 }
196 197
197 void InfoBar::GetTopColor(InfoBarDelegate::Type type, 198 void InfoBar::GetTopColor(InfoBarDelegate::Type type,
198 double* r, double* g, double *b) { 199 double* r, double* g, double *b) {
199 // These constants are copied from corresponding skia constants from 200 SkColor color = GetInfoBarTopColor(type);
200 // browser/ui/views/infobars/infobars.cc, and then changed into 0-1 ranged 201 *r = SkColorGetR(color) / 255.0;
201 // values for cairo. 202 *g = SkColorGetG(color) / 255.0;
202 switch (type) { 203 *b = SkColorGetB(color) / 255.0;
203 case InfoBarDelegate::WARNING_TYPE:
204 *r = 255.0 / 255.0;
205 *g = 242.0 / 255.0;
206 *b = 183.0 / 255.0;
207 break;
208 case InfoBarDelegate::PAGE_ACTION_TYPE:
209 *r = 218.0 / 255.0;
210 *g = 231.0 / 255.0;
211 *b = 249.0 / 255.0;
212 break;
213 }
214 } 204 }
215 205
216 void InfoBar::GetBottomColor(InfoBarDelegate::Type type, 206 void InfoBar::GetBottomColor(InfoBarDelegate::Type type,
217 double* r, double* g, double *b) { 207 double* r, double* g, double *b) {
218 switch (type) { 208 SkColor color = GetInfoBarBottomColor(type);
219 case InfoBarDelegate::WARNING_TYPE: 209 *r = SkColorGetR(color) / 255.0;
220 *r = 250.0 / 255.0; 210 *g = SkColorGetG(color) / 255.0;
221 *g = 230.0 / 255.0; 211 *b = SkColorGetB(color) / 255.0;
222 *b = 145.0 / 255.0;
223 break;
224 case InfoBarDelegate::PAGE_ACTION_TYPE:
225 *r = 179.0 / 255.0;
226 *g = 202.0 / 255.0;
227 *b = 231.0 / 255.0;
228 break;
229 }
230 } 212 }
231 213
232 void InfoBar::UpdateBorderColor() { 214 void InfoBar::UpdateBorderColor() {
233 gtk_widget_queue_draw(widget()); 215 gtk_widget_queue_draw(widget());
234 } 216 }
235 217
236 void InfoBar::OnCloseButton(GtkWidget* button) { 218 void InfoBar::OnCloseButton(GtkWidget* button) {
237 if (delegate_) 219 if (delegate_)
238 delegate_->InfoBarDismissed(); 220 delegate_->InfoBarDismissed();
239 RemoveInfoBar(); 221 RemoveInfoBar();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); 264 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent);
283 int x = browser_window ? 265 int x = browser_window ?
284 browser_window->GetXPositionOfLocationIcon(sender) : 0; 266 browser_window->GetXPositionOfLocationIcon(sender) : 0;
285 267
286 size_t size = InfoBarArrowModel::kDefaultArrowSize; 268 size_t size = InfoBarArrowModel::kDefaultArrowSize;
287 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size); 269 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size);
288 arrow_model_.Paint(sender, event, arrow_bounds, border_color); 270 arrow_model_.Paint(sender, event, arrow_bounds, border_color);
289 271
290 return FALSE; 272 return FALSE;
291 } 273 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/translate/translate_infobar_base.mm ('k') | chrome/browser/ui/views/infobars/infobar_background.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698