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

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

Issue 8789018: Revert 113047 - Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 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
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 (ExtensionSet::const_iterator it = service->extensions()->begin(); 645 for (size_t i = 0; i < service->extensions()->size(); ++i) {
646 it != service->extensions()->end(); ++it) { 646 if (service->extensions()->at(i)->page_action())
647 if ((*it)->page_action()) 647 page_actions.push_back(service->extensions()->at(i)->page_action());
648 page_actions.push_back((*it)->page_action());
649 } 648 }
650 649
651 // Initialize on the first call, or re-inialize if more extensions have been 650 // Initialize on the first call, or re-inialize if more extensions have been
652 // loaded or added after startup. 651 // loaded or added after startup.
653 if (page_actions.size() != page_action_views_.size()) { 652 if (page_actions.size() != page_action_views_.size()) {
654 page_action_views_.reset(); // Delete the old views (if any). 653 page_action_views_.reset(); // Delete the old views (if any).
655 654
656 for (size_t i = 0; i < page_actions.size(); ++i) { 655 for (size_t i = 0; i < page_actions.size(); ++i) {
657 page_action_views_.push_back( 656 page_action_views_.push_back(
658 new PageActionViewGtk(this, page_actions[i])); 657 new PageActionViewGtk(this, page_actions[i]));
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 1631
1633 std::string badge_text = page_action_->GetBadgeText(tab_id); 1632 std::string badge_text = page_action_->GetBadgeText(tab_id);
1634 if (badge_text.empty()) 1633 if (badge_text.empty())
1635 return FALSE; 1634 return FALSE;
1636 1635
1637 gfx::CanvasSkiaPaint canvas(event, false); 1636 gfx::CanvasSkiaPaint canvas(event, false);
1638 gfx::Rect bounding_rect(widget->allocation); 1637 gfx::Rect bounding_rect(widget->allocation);
1639 page_action_->PaintBadge(&canvas, bounding_rect, tab_id); 1638 page_action_->PaintBadge(&canvas, bounding_rect, tab_id);
1640 return FALSE; 1639 return FALSE;
1641 } 1640 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698