| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/location_bar_view_mac.h" | 5 #import "chrome/browser/cocoa/location_bar_view_mac.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/nsimage_cache_mac.h" | 10 #include "base/nsimage_cache_mac.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void LocationBarViewMac::UpdatePageActions() { | 180 void LocationBarViewMac::UpdatePageActions() { |
| 181 size_t count_before = page_action_views_.Count(); | 181 size_t count_before = page_action_views_.Count(); |
| 182 page_action_views_.RefreshViews(); | 182 page_action_views_.RefreshViews(); |
| 183 [field_ resetFieldEditorFrameIfNeeded]; | 183 [field_ resetFieldEditorFrameIfNeeded]; |
| 184 if (page_action_views_.Count() != count_before) { | 184 if (page_action_views_.Count() != count_before) { |
| 185 NotificationService::current()->Notify( | 185 NotificationService::current()->Notify( |
| 186 NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, | 186 NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, |
| 187 Source<LocationBar>(this), | 187 Source<LocationBar>(this), |
| 188 NotificationService::NoDetails()); | 188 NotificationService::NoDetails()); |
| 189 } | 189 } |
| 190 [field_ setNeedsDisplay:YES]; |
| 190 } | 191 } |
| 191 | 192 |
| 192 void LocationBarViewMac::InvalidatePageActions() { | 193 void LocationBarViewMac::InvalidatePageActions() { |
| 193 size_t count_before = page_action_views_.Count(); | 194 size_t count_before = page_action_views_.Count(); |
| 194 page_action_views_.DeleteAll(); | 195 page_action_views_.DeleteAll(); |
| 195 if (page_action_views_.Count() != count_before) { | 196 if (page_action_views_.Count() != count_before) { |
| 196 NotificationService::current()->Notify( | 197 NotificationService::current()->Notify( |
| 197 NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, | 198 NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, |
| 198 Source<LocationBar>(this), | 199 Source<LocationBar>(this), |
| 199 NotificationService::NoDetails()); | 200 NotificationService::NoDetails()); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // Map the index of the loaded image back to its name. If we ever get an | 693 // Map the index of the loaded image back to its name. If we ever get an |
| 693 // index greater than the number of icons, it must be the default icon. | 694 // index greater than the number of icons, it must be the default icon. |
| 694 if (image) { | 695 if (image) { |
| 695 if (index < static_cast<int>(page_action_->icon_paths()->size())) | 696 if (index < static_cast<int>(page_action_->icon_paths()->size())) |
| 696 page_action_icons_[page_action_->icon_paths()->at(index)] = *image; | 697 page_action_icons_[page_action_->icon_paths()->at(index)] = *image; |
| 697 else | 698 else |
| 698 page_action_icons_[page_action_->default_icon_path()] = *image; | 699 page_action_icons_[page_action_->default_icon_path()] = *image; |
| 699 } | 700 } |
| 700 | 701 |
| 701 owner_->UpdatePageActions(); | 702 owner_->UpdatePageActions(); |
| 702 | |
| 703 if (preview_enabled_) | |
| 704 [owner_->GetAutocompleteTextField() display]; | |
| 705 } | 703 } |
| 706 | 704 |
| 707 void LocationBarViewMac::PageActionImageView::UpdateVisibility( | 705 void LocationBarViewMac::PageActionImageView::UpdateVisibility( |
| 708 TabContents* contents, const GURL& url) { | 706 TabContents* contents, const GURL& url) { |
| 709 // Save this off so we can pass it back to the extension when the action gets | 707 // Save this off so we can pass it back to the extension when the action gets |
| 710 // executed. See PageActionImageView::OnMousePressed. | 708 // executed. See PageActionImageView::OnMousePressed. |
| 711 current_tab_id_ = ExtensionTabUtil::GetTabId(contents); | 709 current_tab_id_ = ExtensionTabUtil::GetTabId(contents); |
| 712 current_url_ = url; | 710 current_url_ = url; |
| 713 | 711 |
| 714 bool visible = preview_enabled_ || | 712 bool visible = preview_enabled_ || |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 ++result; | 936 ++result; |
| 939 } | 937 } |
| 940 return result; | 938 return result; |
| 941 } | 939 } |
| 942 | 940 |
| 943 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame, | 941 void LocationBarViewMac::PageActionViewList::OnMousePressed(NSRect iconFrame, |
| 944 size_t index) { | 942 size_t index) { |
| 945 ViewAt(index)->OnMousePressed(iconFrame); | 943 ViewAt(index)->OnMousePressed(iconFrame); |
| 946 } | 944 } |
| 947 | 945 |
| OLD | NEW |