| 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/confirm_bubble_view.h" | 5 #include "chrome/browser/ui/gtk/confirm_bubble_view.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/confirm_bubble_model.h" | 12 #include "chrome/browser/ui/confirm_bubble_model.h" |
| 13 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 13 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 14 #include "chrome/browser/ui/gtk/custom_button.h" | 14 #include "chrome/browser/ui/gtk/custom_button.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 17 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "ui/base/gtk/gtk_hig_constants.h" | 19 #include "ui/base/gtk/gtk_hig_constants.h" |
| 20 #include "ui/base/gtk/gtk_screen_util.h" | 20 #include "ui/base/gtk/gtk_screen_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // Padding between content and edge of bubble. | 26 // Padding between content and edge of bubble. |
| 27 const int kContentBorder = 7; | 27 const int kContentBorder = 7; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ConfirmBubbleView::BubbleClosing(BubbleGtk* bubble, | 64 void ConfirmBubbleView::BubbleClosing(BubbleGtk* bubble, |
| 65 bool closed_by_escape) { | 65 bool closed_by_escape) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ConfirmBubbleView::Show() { | 68 void ConfirmBubbleView::Show() { |
| 69 GtkWidget* toplevel = gtk_widget_get_toplevel(anchor_); | 69 GtkWidget* toplevel = gtk_widget_get_toplevel(anchor_); |
| 70 BrowserWindowGtk* browser_window = | 70 BrowserWindowGtk* browser_window = |
| 71 BrowserWindowGtk::GetBrowserWindowForNativeWindow(GTK_WINDOW(toplevel)); | 71 BrowserWindowGtk::GetBrowserWindowForNativeWindow(GTK_WINDOW(toplevel)); |
| 72 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom( | 72 GtkThemeService* theme_service = GtkThemeService::GetFrom( |
| 73 browser_window->browser()->profile()); | 73 browser_window->browser()->profile()); |
| 74 | 74 |
| 75 GtkWidget* content = gtk_vbox_new(FALSE, kInterLineSpacing); | 75 GtkWidget* content = gtk_vbox_new(FALSE, kInterLineSpacing); |
| 76 gtk_container_set_border_width(GTK_CONTAINER(content), kContentBorder); | 76 gtk_container_set_border_width(GTK_CONTAINER(content), kContentBorder); |
| 77 g_signal_connect(content, "destroy", G_CALLBACK(OnDestroyThunk), this); | 77 g_signal_connect(content, "destroy", G_CALLBACK(OnDestroyThunk), this); |
| 78 | 78 |
| 79 // Add the icon, the title label and the close button to the first row. | 79 // Add the icon, the title label and the close button to the first row. |
| 80 GtkWidget* row = gtk_hbox_new(FALSE, kImageViewSpacing); | 80 GtkWidget* row = gtk_hbox_new(FALSE, kImageViewSpacing); |
| 81 GtkWidget* icon_view = | 81 GtkWidget* icon_view = |
| 82 gtk_image_new_from_pixbuf(model_->GetIcon()->ToGdkPixbuf()); | 82 gtk_image_new_from_pixbuf(model_->GetIcon()->ToGdkPixbuf()); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // click this button. We should ask the model if we can close this view. | 175 // click this button. We should ask the model if we can close this view. |
| 176 bubble_->Close(); | 176 bubble_->Close(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void ConfirmBubbleView::OnLinkButton(GtkWidget* sender) { | 179 void ConfirmBubbleView::OnLinkButton(GtkWidget* sender) { |
| 180 model_->LinkClicked(); | 180 model_->LinkClicked(); |
| 181 // TODO(hbono): this code prevents the model from updating this view when we | 181 // TODO(hbono): this code prevents the model from updating this view when we |
| 182 // click this link. We should ask the model if we can close this view. | 182 // click this link. We should ask the model if we can close this view. |
| 183 bubble_->Close(); | 183 bubble_->Close(); |
| 184 } | 184 } |
| OLD | NEW |