OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gfx/canvas_paint.h" | 9 #include "app/gfx/canvas_paint.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 gtk_widget_hide_all(event_box_.get()); | 1157 gtk_widget_hide_all(event_box_.get()); |
1158 | 1158 |
1159 if (visible != old_visible) { | 1159 if (visible != old_visible) { |
1160 NotificationService::current()->Notify( | 1160 NotificationService::current()->Notify( |
1161 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 1161 NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
1162 Source<ExtensionAction>(page_action_), | 1162 Source<ExtensionAction>(page_action_), |
1163 Details<TabContents>(contents)); | 1163 Details<TabContents>(contents)); |
1164 } | 1164 } |
1165 } | 1165 } |
1166 | 1166 |
1167 void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(SkBitmap* image, | 1167 void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded( |
1168 size_t index) { | 1168 ImageLoadingTracker* source, SkBitmap* image, size_t index) { |
1169 // We loaded icons()->size() icons, plus one extra if the page action had | 1169 // We loaded icons()->size() icons, plus one extra if the page action had |
1170 // a default icon. | 1170 // a default icon. |
1171 size_t total_icons = page_action_->icon_paths()->size(); | 1171 size_t total_icons = page_action_->icon_paths()->size(); |
1172 if (!page_action_->default_icon_path().empty()) | 1172 if (!page_action_->default_icon_path().empty()) |
1173 total_icons++; | 1173 total_icons++; |
1174 DCHECK(index < total_icons); | 1174 DCHECK(index < total_icons); |
1175 | 1175 |
1176 // Map the index of the loaded image back to its name. If we ever get an | 1176 // Map the index of the loaded image back to its name. If we ever get an |
1177 // index greater than the number of icons, it must be the default icon. | 1177 // index greater than the number of icons, it must be the default icon. |
1178 if (image) { | 1178 if (image) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1243 |
1244 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1244 std::string badge_text = page_action_->GetBadgeText(tab_id); |
1245 if (badge_text.empty()) | 1245 if (badge_text.empty()) |
1246 return FALSE; | 1246 return FALSE; |
1247 | 1247 |
1248 gfx::CanvasPaint canvas(event, false); | 1248 gfx::CanvasPaint canvas(event, false); |
1249 gfx::Rect bounding_rect(widget->allocation); | 1249 gfx::Rect bounding_rect(widget->allocation); |
1250 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1250 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
1251 return FALSE; | 1251 return FALSE; |
1252 } | 1252 } |
OLD | NEW |