OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 break; | 622 break; |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, | 626 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, |
627 const SearchModel::State& new_state) { | 627 const SearchModel::State& new_state) { |
628 if (UpdateMicSearchDecorationVisibility()) | 628 if (UpdateMicSearchDecorationVisibility()) |
629 Layout(); | 629 Layout(); |
630 } | 630 } |
631 | 631 |
| 632 void LocationBarViewMac::ActivatePageAction(const std::string& extension_id) { |
| 633 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| 634 if (page_action_decorations_[i]->page_action()->extension_id() == |
| 635 extension_id) { |
| 636 page_action_decorations_[i]->ActivatePageAction(); |
| 637 return; |
| 638 } |
| 639 } |
| 640 } |
| 641 |
632 void LocationBarViewMac::PostNotification(NSString* notification) { | 642 void LocationBarViewMac::PostNotification(NSString* notification) { |
633 [[NSNotificationCenter defaultCenter] postNotificationName:notification | 643 [[NSNotificationCenter defaultCenter] postNotificationName:notification |
634 object:[NSValue valueWithPointer:this]]; | 644 object:[NSValue valueWithPointer:this]]; |
635 } | 645 } |
636 | 646 |
637 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( | 647 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( |
638 ExtensionAction* page_action) { | 648 ExtensionAction* page_action) { |
639 DCHECK(page_action); | 649 DCHECK(page_action); |
640 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 650 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
641 if (page_action_decorations_[i]->page_action() == page_action) | 651 if (page_action_decorations_[i]->page_action() == page_action) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 755 } |
746 | 756 |
747 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 757 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
748 bool is_visible = !GetToolbarModel()->input_in_progress() && | 758 bool is_visible = !GetToolbarModel()->input_in_progress() && |
749 browser_->search_model()->voice_search_supported(); | 759 browser_->search_model()->voice_search_supported(); |
750 if (mic_search_decoration_->IsVisible() == is_visible) | 760 if (mic_search_decoration_->IsVisible() == is_visible) |
751 return false; | 761 return false; |
752 mic_search_decoration_->SetVisible(is_visible); | 762 mic_search_decoration_->SetVisible(is_visible); |
753 return true; | 763 return true; |
754 } | 764 } |
OLD | NEW |