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

Side by Side Diff: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc

Issue 9424024: Force browser action icon size to always be 19px (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small change to comment. Created 8 years, 10 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
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/browser_actions_toolbar_gtk.h" 5 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 19 matching lines...) Expand all
30 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/extensions/extension.h" 31 #include "chrome/common/extensions/extension.h"
32 #include "chrome/common/extensions/extension_action.h" 32 #include "chrome/common/extensions/extension_action.h"
33 #include "chrome/common/extensions/extension_resource.h" 33 #include "chrome/common/extensions/extension_resource.h"
34 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "grit/theme_resources.h" 36 #include "grit/theme_resources.h"
37 #include "grit/theme_resources_standard.h" 37 #include "grit/theme_resources_standard.h"
38 #include "grit/ui_resources.h" 38 #include "grit/ui_resources.h"
39 #include "ui/base/gtk/gtk_compat.h" 39 #include "ui/base/gtk/gtk_compat.h"
40 #include "ui/base/resource/resource_bundle.h"
40 #include "ui/gfx/canvas_skia_paint.h" 41 #include "ui/gfx/canvas_skia_paint.h"
41 #include "ui/gfx/gtk_util.h" 42 #include "ui/gfx/gtk_util.h"
42 43
43 namespace { 44 namespace {
44 45
45 // The width of the browser action buttons. 46 // The width of the browser action buttons.
46 const int kButtonWidth = 27; 47 const int kButtonWidth = 27;
47 48
48 // The padding between browser action buttons. 49 // The padding between browser action buttons.
49 const int kButtonPadding = 4; 50 const int kButtonPadding = 4;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 UpdateState(); 111 UpdateState();
111 112
112 // The Browser Action API does not allow the default icon path to be 113 // The Browser Action API does not allow the default icon path to be
113 // changed at runtime, so we can load this now and cache it. 114 // changed at runtime, so we can load this now and cache it.
114 std::string path = extension_->browser_action()->default_icon_path(); 115 std::string path = extension_->browser_action()->default_icon_path();
115 if (!path.empty()) { 116 if (!path.empty()) {
116 tracker_.LoadImage(extension_, extension_->GetResource(path), 117 tracker_.LoadImage(extension_, extension_->GetResource(path),
117 gfx::Size(Extension::kBrowserActionIconMaxSize, 118 gfx::Size(Extension::kBrowserActionIconMaxSize,
118 Extension::kBrowserActionIconMaxSize), 119 Extension::kBrowserActionIconMaxSize),
119 ImageLoadingTracker::DONT_CACHE); 120 ImageLoadingTracker::DONT_CACHE);
121 } else {
122 SkBitmap bm = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
123 IDR_EXTENSIONS_FAVICON);
124 default_skbitmap_ = bm;
125 default_icon_ = gfx::GdkPixbufFromSkBitmap(&bm);
126 UpdateState();
120 } 127 }
121 128
122 signals_.Connect(button(), "button-press-event", 129 signals_.Connect(button(), "button-press-event",
123 G_CALLBACK(OnButtonPress), this); 130 G_CALLBACK(OnButtonPress), this);
124 signals_.Connect(button(), "clicked", 131 signals_.Connect(button(), "clicked",
125 G_CALLBACK(OnClicked), this); 132 G_CALLBACK(OnClicked), this);
126 signals_.Connect(button(), "drag-begin", 133 signals_.Connect(button(), "drag-begin",
127 G_CALLBACK(&OnDragBegin), this); 134 G_CALLBACK(&OnDragBegin), this);
128 signals_.ConnectAfter(widget(), "expose-event", 135 signals_.ConnectAfter(widget(), "expose-event",
129 G_CALLBACK(OnExposeEvent), this); 136 G_CALLBACK(OnExposeEvent), this);
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 980
974 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), 981 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root),
975 event->time); 982 event->time);
976 return TRUE; 983 return TRUE;
977 } 984 }
978 985
979 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 986 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
980 if (!resize_animation_.is_animating()) 987 if (!resize_animation_.is_animating())
981 UpdateChevronVisibility(); 988 UpdateChevronVisibility();
982 } 989 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698