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" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 GtkThemeService* theme_provider = GtkThemeService::GetFrom( | 180 GtkThemeService* theme_provider = GtkThemeService::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()); |
191 if (size.width() > kIconSize || size.height() > kIconSize) { | 191 if (size.width() > kIconSize || size.height() > kIconSize) { |
192 if (size.width() > size.height()) { | 192 if (size.width() > size.height()) { |
193 size.set_height(size.height() * kIconSize / size.width()); | 193 size.set_height(size.height() * kIconSize / size.width()); |
194 size.set_width(kIconSize); | 194 size.set_width(kIconSize); |
195 } else { | 195 } else { |
196 size.set_width(size.width() * kIconSize / size.height()); | 196 size.set_width(size.width() * kIconSize / size.height()); |
197 size.set_height(kIconSize); | 197 size.set_height(kIconSize); |
198 } | 198 } |
199 | 199 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // on all references being cleared before it is destroyed. | 354 // on all references being cleared before it is destroyed. |
355 MessageLoopForUI::current()->PostTask( | 355 MessageLoopForUI::current()->PostTask( |
356 FROM_HERE, | 356 FROM_HERE, |
357 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 357 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
358 } | 358 } |
359 | 359 |
360 void ExtensionInstalledBubbleGtk::Close() { | 360 void ExtensionInstalledBubbleGtk::Close() { |
361 Release(); // Balanced in ctor. | 361 Release(); // Balanced in ctor. |
362 bubble_ = NULL; | 362 bubble_ = NULL; |
363 } | 363 } |
OLD | NEW |