Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 10828364: Don't show the button for hidden page/browser actions or script badges. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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));
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 // The bubble point positioning assumes that the page action is visible. If
425 // not, something else needs to be done otherwise the bubble will appear
426 // near the top left corner (unanchored).
427 NOTREACHED();
425 return NSZeroPoint; 428 return NSZeroPoint;
429 }
426 430
427 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); 431 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame);
428 return [field_ convertPoint:bubble_point toView:nil]; 432 return [field_ convertPoint:bubble_point toView:nil];
429 } 433 }
430 434
431 NSRect LocationBarViewMac::GetBlockedPopupRect() const { 435 NSRect LocationBarViewMac::GetBlockedPopupRect() const {
432 const size_t kPopupIndex = CONTENT_SETTINGS_TYPE_POPUPS; 436 const size_t kPopupIndex = CONTENT_SETTINGS_TYPE_POPUPS;
433 const LocationBarDecoration* decoration = 437 const LocationBarDecoration* decoration =
434 content_setting_decorations_[kPopupIndex]; 438 content_setting_decorations_[kPopupIndex];
435 if (!decoration || !decoration->IsVisible()) 439 if (!decoration || !decoration->IsVisible())
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 void LocationBarViewMac::UpdateChromeToMobileEnabled() { 745 void LocationBarViewMac::UpdateChromeToMobileEnabled() {
742 if (!chrome_to_mobile_decoration_.get()) 746 if (!chrome_to_mobile_decoration_.get())
743 return; 747 return;
744 748
745 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); 749 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled());
746 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && 750 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() &&
747 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); 751 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles();
748 chrome_to_mobile_decoration_->SetVisible(enabled); 752 chrome_to_mobile_decoration_->SetVisible(enabled);
749 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); 753 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
750 } 754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698