| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 new EVBubbleDecoration(location_icon_decoration_.get())), | 126 new EVBubbleDecoration(location_icon_decoration_.get())), |
| 127 star_decoration_(new StarDecoration(command_updater)), | 127 star_decoration_(new StarDecoration(command_updater)), |
| 128 translate_decoration_(new TranslateDecoration(command_updater)), | 128 translate_decoration_(new TranslateDecoration(command_updater)), |
| 129 zoom_decoration_(new ZoomDecoration(this)), | 129 zoom_decoration_(new ZoomDecoration(this)), |
| 130 keyword_hint_decoration_(new KeywordHintDecoration()), | 130 keyword_hint_decoration_(new KeywordHintDecoration()), |
| 131 mic_search_decoration_(new MicSearchDecoration(command_updater)), | 131 mic_search_decoration_(new MicSearchDecoration(command_updater)), |
| 132 generated_credit_card_decoration_( | 132 generated_credit_card_decoration_( |
| 133 new GeneratedCreditCardDecoration(this)), | 133 new GeneratedCreditCardDecoration(this)), |
| 134 search_button_decoration_(new SearchButtonDecoration(this)), | 134 search_button_decoration_(new SearchButtonDecoration(this)), |
| 135 manage_passwords_decoration_( | 135 manage_passwords_decoration_( |
| 136 new ManagePasswordsDecoration(command_updater, this)), | 136 new ManagePasswordsDecoration(command_updater)), |
| 137 browser_(browser), | 137 browser_(browser), |
| 138 weak_ptr_factory_(this) { | 138 weak_ptr_factory_(this) { |
| 139 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 139 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 140 DCHECK_EQ(i, content_setting_decorations_.size()); | 140 DCHECK_EQ(i, content_setting_decorations_.size()); |
| 141 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 141 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
| 142 content_setting_decorations_.push_back( | 142 content_setting_decorations_.push_back( |
| 143 new ContentSettingDecoration(type, this, profile)); | 143 new ContentSettingDecoration(type, this, profile)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 registrar_.Add( | 146 registrar_.Add( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 if (RefreshContentSettingsDecorations()) | 215 if (RefreshContentSettingsDecorations()) |
| 216 OnDecorationsChanged(); | 216 OnDecorationsChanged(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void LocationBarViewMac::UpdateManagePasswordsIconAndBubble() { | 219 void LocationBarViewMac::UpdateManagePasswordsIconAndBubble() { |
| 220 WebContents* web_contents = GetWebContents(); | 220 WebContents* web_contents = GetWebContents(); |
| 221 if (!web_contents) | 221 if (!web_contents) |
| 222 return; | 222 return; |
| 223 ManagePasswordsUIController::FromWebContents(web_contents) | 223 ManagePasswordsUIController::FromWebContents(web_contents) |
| 224 ->UpdateIconAndBubbleState(manage_passwords_decoration_->icon()); | 224 ->UpdateIconAndBubbleState(manage_passwords_decoration_->icon()); |
| 225 OnDecorationsChanged(); | |
| 226 } | 225 } |
| 227 | 226 |
| 228 void LocationBarViewMac::UpdatePageActions() { | 227 void LocationBarViewMac::UpdatePageActions() { |
| 229 RefreshPageActionDecorations(); | 228 RefreshPageActionDecorations(); |
| 230 Layout(); | 229 Layout(); |
| 231 } | 230 } |
| 232 | 231 |
| 233 void LocationBarViewMac::InvalidatePageActions() { | 232 void LocationBarViewMac::InvalidatePageActions() { |
| 234 DeletePageActionDecorations(); | 233 DeletePageActionDecorations(); |
| 235 Layout(); | 234 Layout(); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // near the top left corner (unanchored). | 519 // near the top left corner (unanchored). |
| 521 NOTREACHED(); | 520 NOTREACHED(); |
| 522 return NSZeroPoint; | 521 return NSZeroPoint; |
| 523 } | 522 } |
| 524 | 523 |
| 525 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); | 524 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); |
| 526 return [field_ convertPoint:bubble_point toView:nil]; | 525 return [field_ convertPoint:bubble_point toView:nil]; |
| 527 } | 526 } |
| 528 | 527 |
| 529 void LocationBarViewMac::Update(const WebContents* contents) { | 528 void LocationBarViewMac::Update(const WebContents* contents) { |
| 530 UpdateManagePasswordsIconAndBubble(); | |
| 531 UpdateStarDecorationVisibility(); | 529 UpdateStarDecorationVisibility(); |
| 532 UpdateTranslateDecoration(); | 530 UpdateTranslateDecoration(); |
| 533 UpdateZoomDecoration(); | 531 UpdateZoomDecoration(); |
| 534 RefreshPageActionDecorations(); | 532 RefreshPageActionDecorations(); |
| 535 RefreshContentSettingsDecorations(); | 533 RefreshContentSettingsDecorations(); |
| 536 UpdateMicSearchDecorationVisibility(); | 534 UpdateMicSearchDecorationVisibility(); |
| 537 UpdateGeneratedCreditCardView(); | 535 UpdateGeneratedCreditCardView(); |
| 538 if (contents) | 536 if (contents) |
| 539 omnibox_view_->OnTabChanged(contents); | 537 omnibox_view_->OnTabChanged(contents); |
| 540 else | 538 else |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 } | 793 } |
| 796 | 794 |
| 797 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 795 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 798 bool is_visible = !GetToolbarModel()->input_in_progress() && | 796 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 799 browser_->search_model()->voice_search_supported(); | 797 browser_->search_model()->voice_search_supported(); |
| 800 if (mic_search_decoration_->IsVisible() == is_visible) | 798 if (mic_search_decoration_->IsVisible() == is_visible) |
| 801 return false; | 799 return false; |
| 802 mic_search_decoration_->SetVisible(is_visible); | 800 mic_search_decoration_->SetVisible(is_visible); |
| 803 return true; | 801 return true; |
| 804 } | 802 } |
| OLD | NEW |