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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 decoration->UpdateVisibility(contents, GURL(toolbar_model_->GetText())); | 403 decoration->UpdateVisibility(contents, GURL(toolbar_model_->GetText())); |
404 } | 404 } |
405 | 405 |
406 NSRect LocationBarViewMac::GetPageActionFrame(ExtensionAction* page_action) { | 406 NSRect LocationBarViewMac::GetPageActionFrame(ExtensionAction* page_action) { |
407 PageActionDecoration* decoration = GetPageActionDecoration(page_action); | 407 PageActionDecoration* decoration = GetPageActionDecoration(page_action); |
408 if (!decoration) | 408 if (!decoration) |
409 return NSZeroRect; | 409 return NSZeroRect; |
410 | 410 |
411 AutocompleteTextFieldCell* cell = [field_ cell]; | 411 AutocompleteTextFieldCell* cell = [field_ cell]; |
412 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; | 412 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; |
413 DCHECK(!NSIsEmptyRect(frame)); | |
Finnur
2012/08/17 12:18:16
When I factored GetPageActionFrame out of GetPageA
| |
414 return frame; | 413 return frame; |
415 } | 414 } |
416 | 415 |
417 NSPoint LocationBarViewMac::GetPageActionBubblePoint( | 416 NSPoint LocationBarViewMac::GetPageActionBubblePoint( |
418 ExtensionAction* page_action) { | 417 ExtensionAction* page_action) { |
419 PageActionDecoration* decoration = GetPageActionDecoration(page_action); | 418 PageActionDecoration* decoration = GetPageActionDecoration(page_action); |
420 if (!decoration) | 419 if (!decoration) |
421 return NSZeroPoint; | 420 return NSZeroPoint; |
422 | 421 |
423 NSRect frame = GetPageActionFrame(page_action); | 422 NSRect frame = GetPageActionFrame(page_action); |
424 if (NSIsEmptyRect(frame)) | 423 if (NSIsEmptyRect(frame)) { |
424 NOTREACHED(); | |
425 return NSZeroPoint; | 425 return NSZeroPoint; |
426 } | |
426 | 427 |
427 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); | 428 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); |
428 return [field_ convertPoint:bubble_point toView:nil]; | 429 return [field_ convertPoint:bubble_point toView:nil]; |
429 } | 430 } |
430 | 431 |
431 NSRect LocationBarViewMac::GetBlockedPopupRect() const { | 432 NSRect LocationBarViewMac::GetBlockedPopupRect() const { |
432 const size_t kPopupIndex = CONTENT_SETTINGS_TYPE_POPUPS; | 433 const size_t kPopupIndex = CONTENT_SETTINGS_TYPE_POPUPS; |
433 const LocationBarDecoration* decoration = | 434 const LocationBarDecoration* decoration = |
434 content_setting_decorations_[kPopupIndex]; | 435 content_setting_decorations_[kPopupIndex]; |
435 if (!decoration || !decoration->IsVisible()) | 436 if (!decoration || !decoration->IsVisible()) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 742 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
742 if (!chrome_to_mobile_decoration_.get()) | 743 if (!chrome_to_mobile_decoration_.get()) |
743 return; | 744 return; |
744 | 745 |
745 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 746 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
746 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 747 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
747 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); | 748 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); |
748 chrome_to_mobile_decoration_->SetVisible(enabled); | 749 chrome_to_mobile_decoration_->SetVisible(enabled); |
749 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 750 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
750 } | 751 } |
OLD | NEW |