| 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 8 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 9 #include "chrome/browser/ui/gtk/custom_button.h" | 9 #include "chrome/browser/ui/gtk/custom_button.h" |
| 10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 10 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 11 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 11 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_util.h" | 12 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 13 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" | 13 #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "content/common/notification_service.h" | 16 #include "content/common/notification_service.h" |
| 17 #include "ui/base/gtk/gtk_expanded_container.h" | 17 #include "ui/base/gtk/gtk_expanded_container.h" |
| 18 #include "ui/base/gtk/gtk_hig_constants.h" | |
| 19 #include "ui/gfx/gtk_util.h" | 18 #include "ui/gfx/gtk_util.h" |
| 20 #include "ui/gfx/image/image.h" | 19 #include "ui/gfx/image/image.h" |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 // Pixels between infobar elements. | 23 // Pixels between infobar elements. |
| 25 const int kElementPadding = 5; | 24 const int kElementPadding = 5; |
| 26 | 25 |
| 27 // Extra padding on either end of info bar. | 26 // Extra padding on either end of info bar. |
| 28 const int kLeftPadding = 5; | 27 const int kLeftPadding = 5; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 105 |
| 107 GdkColor InfoBarGtk::GetBorderColor() const { | 106 GdkColor InfoBarGtk::GetBorderColor() const { |
| 108 return theme_service_->GetBorderColor(); | 107 return theme_service_->GetBorderColor(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 int InfoBarGtk::AnimatingHeight() const { | 110 int InfoBarGtk::AnimatingHeight() const { |
| 112 return animation().is_animating() ? bar_target_height() : 0; | 111 return animation().is_animating() ? bar_target_height() : 0; |
| 113 } | 112 } |
| 114 | 113 |
| 115 GtkWidget* InfoBarGtk::CreateLabel(const std::string& text) { | 114 GtkWidget* InfoBarGtk::CreateLabel(const std::string& text) { |
| 116 return theme_service_->BuildLabel(text, ui::kGdkBlack); | 115 return theme_service_->BuildLabel(text, gtk_util::kGdkBlack); |
| 117 } | 116 } |
| 118 | 117 |
| 119 GtkWidget* InfoBarGtk::CreateLinkButton(const std::string& text) { | 118 GtkWidget* InfoBarGtk::CreateLinkButton(const std::string& text) { |
| 120 return theme_service_->BuildChromeLinkButton(text); | 119 return theme_service_->BuildChromeLinkButton(text); |
| 121 } | 120 } |
| 122 | 121 |
| 123 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { | 122 SkColor InfoBarGtk::ConvertGetColor(ColorGetter getter) { |
| 124 double r, g, b; | 123 double r, g, b; |
| 125 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); | 124 (this->*getter)(delegate()->GetInfoBarType(), &r, &g, &b); |
| 126 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); | 125 return SkColorSetARGB(255, 255 * r, 255 * g, 255 * b); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 const NotificationSource& source, | 259 const NotificationSource& source, |
| 261 const NotificationDetails& details) { | 260 const NotificationDetails& details) { |
| 262 UpdateBorderColor(); | 261 UpdateBorderColor(); |
| 263 } | 262 } |
| 264 | 263 |
| 265 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 264 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
| 266 GtkWidget* child, | 265 GtkWidget* child, |
| 267 GtkRequisition* requisition) { | 266 GtkRequisition* requisition) { |
| 268 requisition->height = -1; | 267 requisition->height = -1; |
| 269 } | 268 } |
| OLD | NEW |