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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 void LocationBarViewMac::RefreshPageActionDecorations() { | 533 void LocationBarViewMac::RefreshPageActionDecorations() { |
534 if (!IsEditable()) { | 534 if (!IsEditable()) { |
535 DeletePageActionDecorations(); | 535 DeletePageActionDecorations(); |
536 return; | 536 return; |
537 } | 537 } |
538 | 538 |
539 ExtensionService* service = profile_->GetExtensionService(); | 539 ExtensionService* service = profile_->GetExtensionService(); |
540 if (!service) | 540 if (!service) |
541 return; | 541 return; |
542 | 542 |
| 543 // Find all the page actions. |
543 std::vector<ExtensionAction*> page_actions; | 544 std::vector<ExtensionAction*> page_actions; |
544 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 545 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
545 if (service->extensions()->at(i)->page_action()) | 546 it != service->extensions()->end(); ++it) { |
546 page_actions.push_back(service->extensions()->at(i)->page_action()); | 547 if ((*it)->page_action()) |
| 548 page_actions.push_back((*it)->page_action()); |
547 } | 549 } |
548 | 550 |
549 // On startup we sometimes haven't loaded any extensions. This makes sure | 551 // On startup we sometimes haven't loaded any extensions. This makes sure |
550 // we catch up when the extensions (and any Page Actions) load. | 552 // we catch up when the extensions (and any Page Actions) load. |
551 if (page_actions.size() != page_action_decorations_.size()) { | 553 if (page_actions.size() != page_action_decorations_.size()) { |
552 DeletePageActionDecorations(); // Delete the old views (if any). | 554 DeletePageActionDecorations(); // Delete the old views (if any). |
553 | 555 |
554 for (size_t i = 0; i < page_actions.size(); ++i) { | 556 for (size_t i = 0; i < page_actions.size(); ++i) { |
555 page_action_decorations_.push_back( | 557 page_action_decorations_.push_back( |
556 new PageActionDecoration(this, profile_, page_actions[i])); | 558 new PageActionDecoration(this, profile_, page_actions[i])); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 643 |
642 [field_ setNeedsDisplay:YES]; | 644 [field_ setNeedsDisplay:YES]; |
643 } | 645 } |
644 | 646 |
645 bool LocationBarViewMac::IsStarEnabled() { | 647 bool LocationBarViewMac::IsStarEnabled() { |
646 return [field_ isEditable] && | 648 return [field_ isEditable] && |
647 browser_defaults::bookmarks_enabled && | 649 browser_defaults::bookmarks_enabled && |
648 !toolbar_model_->input_in_progress() && | 650 !toolbar_model_->input_in_progress() && |
649 edit_bookmarks_enabled_.GetValue(); | 651 edit_bookmarks_enabled_.GetValue(); |
650 } | 652 } |
OLD | NEW |