| 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/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" | 16 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
| 17 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 17 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 18 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 18 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 20 #include "chrome/browser/ui/gtk/gtk_util.h" | 19 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 21 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 20 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 21 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
| 23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 24 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
| 25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
| 26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 29 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 LocationBarViewGtk* location_bar_view = | 170 LocationBarViewGtk* location_bar_view = |
| 171 browser_window->GetToolbar()->GetLocationBarView(); | 171 browser_window->GetToolbar()->GetLocationBarView(); |
| 172 reference_widget = location_bar_view->location_entry_widget(); | 172 reference_widget = location_bar_view->location_entry_widget(); |
| 173 DCHECK(reference_widget); | 173 DCHECK(reference_widget); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // Default case. | 176 // Default case. |
| 177 if (reference_widget == NULL) | 177 if (reference_widget == NULL) |
| 178 reference_widget = browser_window->GetToolbar()->GetAppMenuButton(); | 178 reference_widget = browser_window->GetToolbar()->GetAppMenuButton(); |
| 179 | 179 |
| 180 GtkThemeService* theme_provider = GtkThemeService::GetFrom( | 180 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom( |
| 181 browser_->profile()); | 181 browser_->profile()); |
| 182 | 182 |
| 183 // Setup the BubbleGtk content. | 183 // Setup the BubbleGtk content. |
| 184 GtkWidget* bubble_content = gtk_hbox_new(FALSE, kHorizontalColumnSpacing); | 184 GtkWidget* bubble_content = gtk_hbox_new(FALSE, kHorizontalColumnSpacing); |
| 185 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); | 185 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); |
| 186 | 186 |
| 187 if (!icon_.isNull()) { | 187 if (!icon_.isNull()) { |
| 188 // Scale icon down to 43x43, but allow smaller icons (don't scale up). | 188 // Scale icon down to 43x43, but allow smaller icons (don't scale up). |
| 189 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon_); | 189 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon_); |
| 190 gfx::Size size(icon_.width(), icon_.height()); | 190 gfx::Size size(icon_.width(), icon_.height()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // on all references being cleared before it is destroyed. | 320 // on all references being cleared before it is destroyed. |
| 321 MessageLoopForUI::current()->PostTask( | 321 MessageLoopForUI::current()->PostTask( |
| 322 FROM_HERE, | 322 FROM_HERE, |
| 323 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 323 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void ExtensionInstalledBubbleGtk::Close() { | 326 void ExtensionInstalledBubbleGtk::Close() { |
| 327 Release(); // Balanced in ctor. | 327 Release(); // Balanced in ctor. |
| 328 bubble_ = NULL; | 328 bubble_ = NULL; |
| 329 } | 329 } |
| OLD | NEW |