OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // These need to change anytime the layout changes. | 692 // These need to change anytime the layout changes. |
693 // TODO(shess): Anytime the field editor might have changed, the | 693 // TODO(shess): Anytime the field editor might have changed, the |
694 // cursor rects almost certainly should have changed. The tooltips | 694 // cursor rects almost certainly should have changed. The tooltips |
695 // might change even when the rects don't change. | 695 // might change even when the rects don't change. |
696 [field_ resetFieldEditorFrameIfNeeded]; | 696 [field_ resetFieldEditorFrameIfNeeded]; |
697 [field_ updateCursorAndToolTipRects]; | 697 [field_ updateCursorAndToolTipRects]; |
698 | 698 |
699 [field_ setNeedsDisplay:YES]; | 699 [field_ setNeedsDisplay:YES]; |
700 } | 700 } |
701 | 701 |
| 702 void LocationBarViewMac::RedrawDecoration(LocationBarDecoration* decoration) { |
| 703 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 704 NSRect frame = [cell frameForDecoration:decoration |
| 705 inFrame:[field_ bounds]]; |
| 706 if (!NSIsEmptyRect(frame)) |
| 707 [field_ setNeedsDisplayInRect:frame]; |
| 708 } |
| 709 |
702 bool LocationBarViewMac::IsStarEnabled() { | 710 bool LocationBarViewMac::IsStarEnabled() { |
703 return [field_ isEditable] && | 711 return [field_ isEditable] && |
704 browser_defaults::bookmarks_enabled && | 712 browser_defaults::bookmarks_enabled && |
705 !toolbar_model_->input_in_progress() && | 713 !toolbar_model_->input_in_progress() && |
706 edit_bookmarks_enabled_.GetValue(); | 714 edit_bookmarks_enabled_.GetValue(); |
707 } | 715 } |
708 | 716 |
709 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 717 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
710 if (!chrome_to_mobile_decoration_.get()) | 718 if (!chrome_to_mobile_decoration_.get()) |
711 return; | 719 return; |
712 | 720 |
713 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 721 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
714 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 722 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
715 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); | 723 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); |
716 chrome_to_mobile_decoration_->SetVisible(enabled); | 724 chrome_to_mobile_decoration_->SetVisible(enabled); |
717 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 725 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
718 } | 726 } |
OLD | NEW |