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

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

Issue 9535002: GTK: Update ImageLoadingTracker::Observer subclasses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/location_bar_view_gtk.h" 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1549
1550 if (visible != old_visible) { 1550 if (visible != old_visible) {
1551 content::NotificationService::current()->Notify( 1551 content::NotificationService::current()->Notify(
1552 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, 1552 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
1553 content::Source<ExtensionAction>(page_action_), 1553 content::Source<ExtensionAction>(page_action_),
1554 content::Details<WebContents>(contents)); 1554 content::Details<WebContents>(contents));
1555 } 1555 }
1556 } 1556 }
1557 1557
1558 void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded( 1558 void LocationBarViewGtk::PageActionViewGtk::OnImageLoaded(
1559 SkBitmap* image, const ExtensionResource& resource, int index) { 1559 const gfx::Image& image,
1560 const std::string& extension_id,
1561 int index) {
1560 // We loaded icons()->size() icons, plus one extra if the page action had 1562 // We loaded icons()->size() icons, plus one extra if the page action had
1561 // a default icon. 1563 // a default icon.
1562 int total_icons = static_cast<int>(page_action_->icon_paths()->size()); 1564 int total_icons = static_cast<int>(page_action_->icon_paths()->size());
1563 if (!page_action_->default_icon_path().empty()) 1565 if (!page_action_->default_icon_path().empty())
1564 total_icons++; 1566 total_icons++;
1565 DCHECK(index < total_icons); 1567 DCHECK(index < total_icons);
1566 1568
1567 // Map the index of the loaded image back to its name. If we ever get an 1569 // Map the index of the loaded image back to its name. If we ever get an
1568 // index greater than the number of icons, it must be the default icon. 1570 // index greater than the number of icons, it must be the default icon.
1569 if (image) { 1571 if (!image.IsEmpty()) {
1570 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(image); 1572 GdkPixbuf* pixbuf = image.ToGdkPixbuf();
1571 if (index < static_cast<int>(page_action_->icon_paths()->size())) 1573 if (index < static_cast<int>(page_action_->icon_paths()->size()))
1572 pixbufs_[page_action_->icon_paths()->at(index)] = pixbuf; 1574 pixbufs_[page_action_->icon_paths()->at(index)] = pixbuf;
1573 else 1575 else
1574 pixbufs_[page_action_->default_icon_path()] = pixbuf; 1576 pixbufs_[page_action_->default_icon_path()] = pixbuf;
1575 } 1577 }
1576 1578
1577 // If we have no owner, that means this class is still being constructed and 1579 // If we have no owner, that means this class is still being constructed and
1578 // we should not UpdatePageActions, since it leads to the PageActions being 1580 // we should not UpdatePageActions, since it leads to the PageActions being
1579 // destroyed again and new ones recreated (causing an infinite loop). 1581 // destroyed again and new ones recreated (causing an infinite loop).
1580 if (owner_) 1582 if (owner_)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 std::string badge_text = page_action_->GetBadgeText(tab_id); 1648 std::string badge_text = page_action_->GetBadgeText(tab_id);
1647 if (badge_text.empty()) 1649 if (badge_text.empty())
1648 return FALSE; 1650 return FALSE;
1649 1651
1650 gfx::CanvasSkiaPaint canvas(event, false); 1652 gfx::CanvasSkiaPaint canvas(event, false);
1651 GtkAllocation allocation; 1653 GtkAllocation allocation;
1652 gtk_widget_get_allocation(widget, &allocation); 1654 gtk_widget_get_allocation(widget, &allocation);
1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); 1655 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id);
1654 return FALSE; 1656 return FALSE;
1655 } 1657 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698