| 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/location_bar_view_mac.h" | 5 #import "chrome/browser/cocoa/location_bar/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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 AutocompleteTextFieldCell* cell = [field_ cell]; | 317 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 318 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; | 318 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; |
| 319 DCHECK(!NSIsEmptyRect(frame)); | 319 DCHECK(!NSIsEmptyRect(frame)); |
| 320 if (NSIsEmptyRect(frame)) | 320 if (NSIsEmptyRect(frame)) |
| 321 return NSZeroPoint; | 321 return NSZeroPoint; |
| 322 | 322 |
| 323 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); | 323 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); |
| 324 return [field_ convertPoint:bubble_point toView:nil]; | 324 return [field_ convertPoint:bubble_point toView:nil]; |
| 325 } | 325 } |
| 326 | 326 |
| 327 NSRect LocationBarViewMac::GetBlockedPopupRect() const { |
| 328 const size_t kPopupIndex = CONTENT_SETTINGS_TYPE_POPUPS; |
| 329 const LocationBarDecoration* decoration = |
| 330 content_setting_decorations_[kPopupIndex]; |
| 331 if (!decoration || !decoration->IsVisible()) |
| 332 return NSZeroRect; |
| 333 |
| 334 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 335 const NSRect frame = [cell frameForDecoration:decoration |
| 336 inFrame:[field_ bounds]]; |
| 337 return [field_ convertRect:frame toView:nil]; |
| 338 } |
| 339 |
| 327 ExtensionAction* LocationBarViewMac::GetPageAction(size_t index) { | 340 ExtensionAction* LocationBarViewMac::GetPageAction(size_t index) { |
| 328 if (index < page_action_decorations_.size()) | 341 if (index < page_action_decorations_.size()) |
| 329 return page_action_decorations_[index]->page_action(); | 342 return page_action_decorations_[index]->page_action(); |
| 330 NOTREACHED(); | 343 NOTREACHED(); |
| 331 return NULL; | 344 return NULL; |
| 332 } | 345 } |
| 333 | 346 |
| 334 ExtensionAction* LocationBarViewMac::GetVisiblePageAction(size_t index) { | 347 ExtensionAction* LocationBarViewMac::GetVisiblePageAction(size_t index) { |
| 335 size_t current = 0; | 348 size_t current = 0; |
| 336 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 349 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 549 |
| 537 // These need to change anytime the layout changes. | 550 // These need to change anytime the layout changes. |
| 538 // TODO(shess): Anytime the field editor might have changed, the | 551 // TODO(shess): Anytime the field editor might have changed, the |
| 539 // cursor rects almost certainly should have changed. The tooltips | 552 // cursor rects almost certainly should have changed. The tooltips |
| 540 // might change even when the rects don't change. | 553 // might change even when the rects don't change. |
| 541 [field_ resetFieldEditorFrameIfNeeded]; | 554 [field_ resetFieldEditorFrameIfNeeded]; |
| 542 [field_ updateCursorAndToolTipRects]; | 555 [field_ updateCursorAndToolTipRects]; |
| 543 | 556 |
| 544 [field_ setNeedsDisplay:YES]; | 557 [field_ setNeedsDisplay:YES]; |
| 545 } | 558 } |
| OLD | NEW |