OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible); | 635 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible); |
636 } | 636 } |
637 | 637 |
638 void LocationBarViewGtk::UpdatePageActions() { | 638 void LocationBarViewGtk::UpdatePageActions() { |
639 std::vector<ExtensionAction*> page_actions; | 639 std::vector<ExtensionAction*> page_actions; |
640 ExtensionService* service = browser_->profile()->GetExtensionService(); | 640 ExtensionService* service = browser_->profile()->GetExtensionService(); |
641 if (!service) | 641 if (!service) |
642 return; | 642 return; |
643 | 643 |
644 // Find all the page actions. | 644 // Find all the page actions. |
645 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 645 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
646 if (service->extensions()->at(i)->page_action()) | 646 it != service->extensions()->end(); ++it) { |
647 page_actions.push_back(service->extensions()->at(i)->page_action()); | 647 if ((*it)->page_action()) |
| 648 page_actions.push_back((*it)->page_action()); |
648 } | 649 } |
649 | 650 |
650 // Initialize on the first call, or re-inialize if more extensions have been | 651 // Initialize on the first call, or re-inialize if more extensions have been |
651 // loaded or added after startup. | 652 // loaded or added after startup. |
652 if (page_actions.size() != page_action_views_.size()) { | 653 if (page_actions.size() != page_action_views_.size()) { |
653 page_action_views_.reset(); // Delete the old views (if any). | 654 page_action_views_.reset(); // Delete the old views (if any). |
654 | 655 |
655 for (size_t i = 0; i < page_actions.size(); ++i) { | 656 for (size_t i = 0; i < page_actions.size(); ++i) { |
656 page_action_views_.push_back( | 657 page_action_views_.push_back( |
657 new PageActionViewGtk(this, page_actions[i])); | 658 new PageActionViewGtk(this, page_actions[i])); |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1632 |
1632 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1633 std::string badge_text = page_action_->GetBadgeText(tab_id); |
1633 if (badge_text.empty()) | 1634 if (badge_text.empty()) |
1634 return FALSE; | 1635 return FALSE; |
1635 | 1636 |
1636 gfx::CanvasSkiaPaint canvas(event, false); | 1637 gfx::CanvasSkiaPaint canvas(event, false); |
1637 gfx::Rect bounding_rect(widget->allocation); | 1638 gfx::Rect bounding_rect(widget->allocation); |
1638 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); | 1639 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); |
1639 return FALSE; | 1640 return FALSE; |
1640 } | 1641 } |
OLD | NEW |