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

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

Issue 9586018: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 8 years, 9 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/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 21 matching lines...) Expand all
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/gfx/canvas_skia_paint.h" 40 #include "ui/gfx/canvas_skia_paint.h"
41 #include "ui/gfx/gtk_util.h" 41 #include "ui/gfx/gtk_util.h"
42 #include "ui/gfx/image/image.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;
50 51
51 // The padding to the right of the browser action buttons (between the buttons 52 // The padding to the right of the browser action buttons (between the buttons
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void Observe(int type, 154 void Observe(int type,
154 const content::NotificationSource& source, 155 const content::NotificationSource& source,
155 const content::NotificationDetails& details) { 156 const content::NotificationDetails& details) {
156 if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) 157 if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED)
157 UpdateState(); 158 UpdateState();
158 else 159 else
159 NOTREACHED(); 160 NOTREACHED();
160 } 161 }
161 162
162 // ImageLoadingTracker::Observer implementation. 163 // ImageLoadingTracker::Observer implementation.
163 void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, 164 void OnImageLoaded(const gfx::Image& image,
164 int index) { 165 const std::string& extension_id,
165 if (image) { 166 int index) OVERRIDE {
166 default_skbitmap_ = *image; 167 if (!image.IsEmpty()) {
167 default_icon_ = gfx::GdkPixbufFromSkBitmap(image); 168 default_skbitmap_ = *image.ToSkBitmap();
169 default_icon_ =
170 static_cast<GdkPixbuf*>(g_object_ref(image.ToGdkPixbuf()));
168 } 171 }
169 UpdateState(); 172 UpdateState();
170 } 173 }
171 174
172 // Updates the button based on the latest state from the associated 175 // Updates the button based on the latest state from the associated
173 // browser action. 176 // browser action.
174 void UpdateState() { 177 void UpdateState() {
175 int tab_id = toolbar_->GetCurrentTabId(); 178 int tab_id = toolbar_->GetCurrentTabId();
176 if (tab_id < 0) 179 if (tab_id < 0)
177 return; 180 return;
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 976
974 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root), 977 menu->PopupAsContext(gfx::Point(event->x_root, event->y_root),
975 event->time); 978 event->time);
976 return TRUE; 979 return TRUE;
977 } 980 }
978 981
979 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { 982 void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) {
980 if (!resize_animation_.is_animating()) 983 if (!resize_animation_.is_animating())
981 UpdateChevronVisibility(); 984 UpdateChevronVisibility();
982 } 985 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698