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