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