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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 base::Unretained(this))); | 147 base::Unretained(this))); |
148 | 148 |
149 browser_->search_model()->AddObserver(this); | 149 browser_->search_model()->AddObserver(this); |
150 | 150 |
151 [[field_ cell] setIsPopupMode: | 151 [[field_ cell] setIsPopupMode: |
152 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; | 152 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; |
153 | 153 |
154 if (chrome::ShouldDisplayOriginChip()) | 154 if (chrome::ShouldDisplayOriginChip()) |
155 origin_chip_decoration_.reset(new OriginChipDecoration( | 155 origin_chip_decoration_.reset(new OriginChipDecoration( |
156 this, location_icon_decoration_.get())); | 156 this, location_icon_decoration_.get())); |
| 157 |
| 158 // Sets images for the decorations, and performs a layout. This call ensures |
| 159 // that this class is in a consistent state after initialization. |
| 160 OnChanged(); |
157 } | 161 } |
158 | 162 |
159 LocationBarViewMac::~LocationBarViewMac() { | 163 LocationBarViewMac::~LocationBarViewMac() { |
160 // Disconnect from cell in case it outlives us. | 164 // Disconnect from cell in case it outlives us. |
161 [[field_ cell] clearDecorations]; | 165 [[field_ cell] clearDecorations]; |
162 | 166 |
163 browser_->search_model()->RemoveObserver(this); | 167 browser_->search_model()->RemoveObserver(this); |
164 } | 168 } |
165 | 169 |
166 void LocationBarViewMac::ShowFirstRunBubble() { | 170 void LocationBarViewMac::ShowFirstRunBubble() { |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 } | 765 } |
762 | 766 |
763 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 767 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
764 bool is_visible = !GetToolbarModel()->input_in_progress() && | 768 bool is_visible = !GetToolbarModel()->input_in_progress() && |
765 browser_->search_model()->voice_search_supported(); | 769 browser_->search_model()->voice_search_supported(); |
766 if (mic_search_decoration_->IsVisible() == is_visible) | 770 if (mic_search_decoration_->IsVisible() == is_visible) |
767 return false; | 771 return false; |
768 mic_search_decoration_->SetVisible(is_visible); | 772 mic_search_decoration_->SetVisible(is_visible); |
769 return true; | 773 return true; |
770 } | 774 } |
OLD | NEW |