| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 12 #include "chrome/browser/ui/gtk/custom_button.h" | 12 #include "chrome/browser/ui/gtk/custom_button.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 13 #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_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 16 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" | 15 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/base/gtk/gtk_expanded_container.h" | 21 #include "ui/base/gtk/gtk_expanded_container.h" |
| 22 #include "ui/base/gtk/gtk_hig_constants.h" | 22 #include "ui/base/gtk/gtk_hig_constants.h" |
| 23 #include "ui/base/gtk/gtk_signal_registrar.h" | 23 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 24 #include "ui/base/models/menu_model.h" | 24 #include "ui/base/models/menu_model.h" |
| 25 #include "ui/gfx/gtk_util.h" | 25 #include "ui/gfx/gtk_util.h" |
| 26 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 const int InfoBar::kMaximumArrowTargetHeight = 24; | 45 const int InfoBar::kMaximumArrowTargetHeight = 24; |
| 46 const int InfoBar::kDefaultArrowTargetHalfWidth = kDefaultArrowTargetHeight; | 46 const int InfoBar::kDefaultArrowTargetHalfWidth = kDefaultArrowTargetHeight; |
| 47 const int InfoBar::kMaximumArrowTargetHalfWidth = 14; | 47 const int InfoBar::kMaximumArrowTargetHalfWidth = 14; |
| 48 const int InfoBar::kDefaultBarTargetHeight = 36; | 48 const int InfoBar::kDefaultBarTargetHeight = 36; |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 const int InfoBarGtk::kEndOfLabelSpacing = 6; | 51 const int InfoBarGtk::kEndOfLabelSpacing = 6; |
| 52 | 52 |
| 53 InfoBarGtk::InfoBarGtk(InfoBarTabHelper* owner, InfoBarDelegate* delegate) | 53 InfoBarGtk::InfoBarGtk(InfoBarTabHelper* owner, InfoBarDelegate* delegate) |
| 54 : InfoBar(owner, delegate), | 54 : InfoBar(owner, delegate), |
| 55 theme_service_(GtkThemeService::GetFrom(Profile::FromBrowserContext( | 55 theme_service_(ThemeServiceGtk::GetFrom(Profile::FromBrowserContext( |
| 56 owner->web_contents()->GetBrowserContext()))), | 56 owner->web_contents()->GetBrowserContext()))), |
| 57 signals_(new ui::GtkSignalRegistrar) { | 57 signals_(new ui::GtkSignalRegistrar) { |
| 58 DCHECK(delegate); | 58 DCHECK(delegate); |
| 59 // Create |hbox_| and pad the sides. | 59 // Create |hbox_| and pad the sides. |
| 60 hbox_ = gtk_hbox_new(FALSE, kElementPadding); | 60 hbox_ = gtk_hbox_new(FALSE, kElementPadding); |
| 61 | 61 |
| 62 // Make the whole infor bar horizontally shrinkable. | 62 // Make the whole infor bar horizontally shrinkable. |
| 63 gtk_widget_set_size_request(hbox_, 0, -1); | 63 gtk_widget_set_size_request(hbox_, 0, -1); |
| 64 | 64 |
| 65 GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1); | 65 GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 const content::NotificationSource& source, | 288 const content::NotificationSource& source, |
| 289 const content::NotificationDetails& details) { | 289 const content::NotificationDetails& details) { |
| 290 UpdateBorderColor(); | 290 UpdateBorderColor(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 293 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
| 294 GtkWidget* child, | 294 GtkWidget* child, |
| 295 GtkRequisition* requisition) { | 295 GtkRequisition* requisition) { |
| 296 requisition->height = -1; | 296 requisition->height = -1; |
| 297 } | 297 } |
| OLD | NEW |