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. | |
544 std::vector<ExtensionAction*> page_actions; | 543 std::vector<ExtensionAction*> page_actions; |
545 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 544 for (size_t i = 0; i < service->extensions()->size(); ++i) { |
546 it != service->extensions()->end(); ++it) { | 545 if (service->extensions()->at(i)->page_action()) |
547 if ((*it)->page_action()) | 546 page_actions.push_back(service->extensions()->at(i)->page_action()); |
548 page_actions.push_back((*it)->page_action()); | |
549 } | 547 } |
550 | 548 |
551 // On startup we sometimes haven't loaded any extensions. This makes sure | 549 // On startup we sometimes haven't loaded any extensions. This makes sure |
552 // we catch up when the extensions (and any Page Actions) load. | 550 // we catch up when the extensions (and any Page Actions) load. |
553 if (page_actions.size() != page_action_decorations_.size()) { | 551 if (page_actions.size() != page_action_decorations_.size()) { |
554 DeletePageActionDecorations(); // Delete the old views (if any). | 552 DeletePageActionDecorations(); // Delete the old views (if any). |
555 | 553 |
556 for (size_t i = 0; i < page_actions.size(); ++i) { | 554 for (size_t i = 0; i < page_actions.size(); ++i) { |
557 page_action_decorations_.push_back( | 555 page_action_decorations_.push_back( |
558 new PageActionDecoration(this, profile_, page_actions[i])); | 556 new PageActionDecoration(this, profile_, page_actions[i])); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 641 |
644 [field_ setNeedsDisplay:YES]; | 642 [field_ setNeedsDisplay:YES]; |
645 } | 643 } |
646 | 644 |
647 bool LocationBarViewMac::IsStarEnabled() { | 645 bool LocationBarViewMac::IsStarEnabled() { |
648 return [field_ isEditable] && | 646 return [field_ isEditable] && |
649 browser_defaults::bookmarks_enabled && | 647 browser_defaults::bookmarks_enabled && |
650 !toolbar_model_->input_in_progress() && | 648 !toolbar_model_->input_in_progress() && |
651 edit_bookmarks_enabled_.GetValue(); | 649 edit_bookmarks_enabled_.GetValue(); |
652 } | 650 } |
OLD | NEW |