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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible); | 636 gtk_widget_set_visible(content_setting_hbox_.get(), any_visible); |
637 } | 637 } |
638 | 638 |
639 void LocationBarViewGtk::UpdatePageActions() { | 639 void LocationBarViewGtk::UpdatePageActions() { |
640 std::vector<ExtensionAction*> page_actions; | 640 std::vector<ExtensionAction*> page_actions; |
641 ExtensionService* service = browser_->profile()->GetExtensionService(); | 641 ExtensionService* service = browser_->profile()->GetExtensionService(); |
642 if (!service) | 642 if (!service) |
643 return; | 643 return; |
644 | 644 |
645 // Find all the page actions. | 645 // Find all the page actions. |
646 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 646 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
647 if (service->extensions()->at(i)->page_action()) | 647 it != service->extensions()->end(); ++it) { |
648 page_actions.push_back(service->extensions()->at(i)->page_action()); | 648 if ((*it)->page_action()) |
| 649 page_actions.push_back((*it)->page_action()); |
649 } | 650 } |
650 | 651 |
651 // Initialize on the first call, or re-inialize if more extensions have been | 652 // Initialize on the first call, or re-inialize if more extensions have been |
652 // loaded or added after startup. | 653 // loaded or added after startup. |
653 if (page_actions.size() != page_action_views_.size()) { | 654 if (page_actions.size() != page_action_views_.size()) { |
654 page_action_views_.reset(); // Delete the old views (if any). | 655 page_action_views_.reset(); // Delete the old views (if any). |
655 | 656 |
656 for (size_t i = 0; i < page_actions.size(); ++i) { | 657 for (size_t i = 0; i < page_actions.size(); ++i) { |
657 page_action_views_.push_back( | 658 page_action_views_.push_back( |
658 new PageActionViewGtk(this, page_actions[i])); | 659 new PageActionViewGtk(this, page_actions[i])); |
(...skipping 972 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 |