Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc

Issue 10918275: [gtk] website settings bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slightly simpler drawing Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "chrome/browser/ui/singleton_tabs.h" 24 #include "chrome/browser/ui/singleton_tabs.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/extensions/extension_action.h" 27 #include "chrome/common/extensions/extension_action.h"
28 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
29 #include "content/public/browser/notification_details.h" 29 #include "content/public/browser/notification_details.h"
30 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
31 #include "grit/chromium_strings.h" 31 #include "grit/chromium_strings.h"
32 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
33 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
34 #include "ui/base/gtk/gtk_hig_constants.h"
34 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/gtk_util.h" 37 #include "ui/gfx/gtk_util.h"
37 38
38 using extensions::Extension; 39 using extensions::Extension;
39 40
40 namespace { 41 namespace {
41 42
42 const int kHorizontalColumnSpacing = 10; 43 const int kHorizontalColumnSpacing = 10;
43 const int kIconPadding = 3; 44 const int kIconPadding = 3;
44 const int kIconSize = 43; 45 const int kIconSize = 43;
45 const int kTextColumnVerticalSpacing = 7; 46 const int kTextColumnVerticalSpacing = 7;
46 const int kTextColumnWidth = 350; 47 const int kTextColumnWidth = 350;
47 48
48 // When showing the bubble for a new browser action, we may have to wait for 49 // When showing the bubble for a new browser action, we may have to wait for
49 // the toolbar to finish animating to know where the item's final position 50 // the toolbar to finish animating to know where the item's final position
50 // will be. 51 // will be.
51 const int kAnimationWaitRetries = 10; 52 const int kAnimationWaitRetries = 10;
52 const int kAnimationWaitMS = 50; 53 const int kAnimationWaitMS = 50;
53 54
54 // Padding between content and edge of bubble.
55 const int kContentBorder = 7;
56
57 } // namespace 55 } // namespace
58 56
59 namespace chrome { 57 namespace chrome {
60 58
61 void ShowExtensionInstalledBubble(const Extension* extension, 59 void ShowExtensionInstalledBubble(const Extension* extension,
62 Browser* browser, 60 Browser* browser,
63 const SkBitmap& icon) { 61 const SkBitmap& icon) {
64 ExtensionInstalledBubbleGtk::Show(extension, browser, icon); 62 ExtensionInstalledBubbleGtk::Show(extension, browser, icon);
65 } 63 }
66 64
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 175
178 // Default case. 176 // Default case.
179 if (reference_widget == NULL) 177 if (reference_widget == NULL)
180 reference_widget = browser_window->GetToolbar()->GetAppMenuButton(); 178 reference_widget = browser_window->GetToolbar()->GetAppMenuButton();
181 179
182 GtkThemeService* theme_provider = GtkThemeService::GetFrom( 180 GtkThemeService* theme_provider = GtkThemeService::GetFrom(
183 browser_->profile()); 181 browser_->profile());
184 182
185 // Setup the BubbleGtk content. 183 // Setup the BubbleGtk content.
186 GtkWidget* bubble_content = gtk_hbox_new(FALSE, kHorizontalColumnSpacing); 184 GtkWidget* bubble_content = gtk_hbox_new(FALSE, kHorizontalColumnSpacing);
187 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); 185 gtk_container_set_border_width(GTK_CONTAINER(bubble_content),
186 ui::kContentAreaBorder);
188 187
189 if (!icon_.isNull()) { 188 if (!icon_.isNull()) {
190 // Scale icon down to 43x43, but allow smaller icons (don't scale up). 189 // Scale icon down to 43x43, but allow smaller icons (don't scale up).
191 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(icon_); 190 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(icon_);
192 gfx::Size size(icon_.width(), icon_.height()); 191 gfx::Size size(icon_.width(), icon_.height());
193 if (size.width() > kIconSize || size.height() > kIconSize) { 192 if (size.width() > kIconSize || size.height() > kIconSize) {
194 if (size.width() > size.height()) { 193 if (size.width() > size.height()) {
195 size.set_height(size.height() * kIconSize / size.width()); 194 size.set_height(size.height() * kIconSize / size.width());
196 size.set_width(kIconSize); 195 size.set_width(kIconSize);
197 } else { 196 } else {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // on all references being cleared before it is destroyed. 387 // on all references being cleared before it is destroyed.
389 MessageLoopForUI::current()->PostTask( 388 MessageLoopForUI::current()->PostTask(
390 FROM_HERE, 389 FROM_HERE,
391 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); 390 base::Bind(&ExtensionInstalledBubbleGtk::Close, this));
392 } 391 }
393 392
394 void ExtensionInstalledBubbleGtk::Close() { 393 void ExtensionInstalledBubbleGtk::Close() {
395 Release(); // Balanced in ctor. 394 Release(); // Balanced in ctor.
396 bubble_ = NULL; 395 bubble_ = NULL;
397 } 396 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/content_setting_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698