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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 7857014: patch for global error bubbles (view/gtk) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 23 matching lines...) Expand all
34 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 34 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
35 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 35 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
36 #import "chrome/browser/ui/cocoa/menu_button.h" 36 #import "chrome/browser/ui/cocoa/menu_button.h"
37 #import "chrome/browser/ui/cocoa/menu_controller.h" 37 #import "chrome/browser/ui/cocoa/menu_controller.h"
38 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" 38 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h"
39 #import "chrome/browser/ui/cocoa/toolbar/reload_button.h" 39 #import "chrome/browser/ui/cocoa/toolbar/reload_button.h"
40 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button.h" 40 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button.h"
41 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h" 41 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h"
42 #import "chrome/browser/ui/cocoa/view_id_util.h" 42 #import "chrome/browser/ui/cocoa/view_id_util.h"
43 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" 43 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h"
44 #include "chrome/browser/ui/global_error_delegate.h"
45 #include "chrome/browser/ui/global_error_service.h"
46 #include "chrome/browser/ui/global_error_service_factory.h"
44 #include "chrome/browser/ui/omnibox/omnibox_view.h" 47 #include "chrome/browser/ui/omnibox/omnibox_view.h"
45 #include "chrome/browser/ui/toolbar/toolbar_model.h" 48 #include "chrome/browser/ui/toolbar/toolbar_model.h"
46 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 49 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
47 #include "chrome/browser/upgrade_detector.h" 50 #include "chrome/browser/upgrade_detector.h"
48 #include "chrome/common/chrome_notification_types.h" 51 #include "chrome/common/chrome_notification_types.h"
49 #include "chrome/common/pref_names.h" 52 #include "chrome/common/pref_names.h"
50 #include "content/browser/tab_contents/tab_contents.h" 53 #include "content/browser/tab_contents/tab_contents.h"
51 #include "content/common/notification_details.h" 54 #include "content/common/notification_details.h"
52 #include "content/common/notification_observer.h" 55 #include "content/common/notification_observer.h"
53 #include "content/common/notification_service.h" 56 #include "content/common/notification_service.h"
(...skipping 16 matching lines...) Expand all
70 73
71 // The minimum width of the location bar in pixels. 74 // The minimum width of the location bar in pixels.
72 const CGFloat kMinimumLocationBarWidth = 100.0; 75 const CGFloat kMinimumLocationBarWidth = 100.0;
73 76
74 // The duration of any animation that occurs within the toolbar in seconds. 77 // The duration of any animation that occurs within the toolbar in seconds.
75 const CGFloat kAnimationDuration = 0.2; 78 const CGFloat kAnimationDuration = 0.2;
76 79
77 // The amount of left padding that the wrench menu should have. 80 // The amount of left padding that the wrench menu should have.
78 const CGFloat kWrenchMenuLeftPadding = 3.0; 81 const CGFloat kWrenchMenuLeftPadding = 3.0;
79 82
83 // The vertical offset of the wrench bubble from the wrench menu button.
84 const CGFloat kWrenchBubblePointOffsetY = 6.0;
85
80 } // namespace 86 } // namespace
81 87
82 @interface ToolbarController(Private) 88 @interface ToolbarController(Private)
83 - (void)addAccessibilityDescriptions; 89 - (void)addAccessibilityDescriptions;
84 - (void)initCommandStatus:(CommandUpdater*)commands; 90 - (void)initCommandStatus:(CommandUpdater*)commands;
85 - (void)prefChanged:(std::string*)prefName; 91 - (void)prefChanged:(std::string*)prefName;
86 - (BackgroundGradientView*)backgroundGradientView; 92 - (BackgroundGradientView*)backgroundGradientView;
87 - (void)toolbarFrameChanged; 93 - (void)toolbarFrameChanged;
88 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate; 94 - (void)pinLocationBarToLeftOfBrowserActionsContainerAndAnimate:(BOOL)animate;
89 - (void)maintainMinimumLocationBarWidth; 95 - (void)maintainMinimumLocationBarWidth;
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 563
558 - (WrenchMenuController*)wrenchMenuController { 564 - (WrenchMenuController*)wrenchMenuController {
559 return wrenchMenuController_; 565 return wrenchMenuController_;
560 } 566 }
561 567
562 - (void)badgeWrenchMenuIfNeeded { 568 - (void)badgeWrenchMenuIfNeeded {
563 if (UpgradeDetector::GetInstance()->notify_upgrade()) { 569 if (UpgradeDetector::GetInstance()->notify_upgrade()) {
564 [[wrenchButton_ cell] 570 [[wrenchButton_ cell]
565 setOverlayImageID:UpgradeDetector::GetInstance()->GetIconResourceID( 571 setOverlayImageID:UpgradeDetector::GetInstance()->GetIconResourceID(
566 UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)]; 572 UpgradeDetector::UPGRADE_ICON_TYPE_BADGE)];
567 } else { 573 return;
568 [[wrenchButton_ cell] setOverlayImageID:0];
569 } 574 }
575
576 const std::vector<GlobalErrorDelegate*>& errors =
577 GlobalErrorServiceFactory::GetForProfile(
578 browser_->profile())->GetErrorDelegates();
579 for (std::vector<GlobalErrorDelegate*>::const_iterator
580 it = errors.begin(); it != errors.end(); ++it) {
581 GlobalErrorDelegate* error = *it;
582 if (error->HasBadge()) {
583 [[wrenchButton_ cell]
584 setOverlayImageID:error->GetBadgeResourceID()];
585 return;
586 }
587 }
588
589 [[wrenchButton_ cell] setOverlayImageID:0];
570 } 590 }
571 591
572 - (void)prefChanged:(std::string*)prefName { 592 - (void)prefChanged:(std::string*)prefName {
573 if (!prefName) return; 593 if (!prefName) return;
574 if (*prefName == prefs::kShowHomeButton) { 594 if (*prefName == prefs::kShowHomeButton) {
575 [self showOptionalHomeButton]; 595 [self showOptionalHomeButton];
576 } 596 }
577 } 597 }
578 598
579 - (void)createBrowserActionButtons { 599 - (void)createBrowserActionButtons {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 [NSAnimationContext beginGrouping]; 735 [NSAnimationContext beginGrouping];
716 [[NSAnimationContext currentContext] setDuration:kAnimationDuration]; 736 [[NSAnimationContext currentContext] setDuration:kAnimationDuration];
717 [[locationBar_ animator] setFrame:locationFrame]; 737 [[locationBar_ animator] setFrame:locationFrame];
718 [NSAnimationContext endGrouping]; 738 [NSAnimationContext endGrouping];
719 } 739 }
720 740
721 - (NSPoint)bookmarkBubblePoint { 741 - (NSPoint)bookmarkBubblePoint {
722 return locationBarView_->GetBookmarkBubblePoint(); 742 return locationBarView_->GetBookmarkBubblePoint();
723 } 743 }
724 744
745 - (NSPoint)wrenchButtonBubblePoint {
746 NSRect bounds = [wrenchButton_ bounds];
747 NSPoint point =
748 NSMakePoint(NSMidX(bounds), NSMaxY(bounds) - kWrenchBubblePointOffsetY);
749 return [wrenchButton_ convertPoint:point toView:nil];
750 }
751
725 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight { 752 - (CGFloat)desiredHeightForCompression:(CGFloat)compressByHeight {
726 // With no toolbar, just ignore the compression. 753 // With no toolbar, just ignore the compression.
727 return hasToolbar_ ? kBaseToolbarHeight - compressByHeight : 754 return hasToolbar_ ? kBaseToolbarHeight - compressByHeight :
728 NSHeight([locationBar_ frame]); 755 NSHeight([locationBar_ frame]);
729 } 756 }
730 757
731 - (void)setDividerOpacity:(CGFloat)opacity { 758 - (void)setDividerOpacity:(CGFloat)opacity {
732 BackgroundGradientView* view = [self backgroundGradientView]; 759 BackgroundGradientView* view = [self backgroundGradientView];
733 [view setShowsDivider:(opacity > 0 ? YES : NO)]; 760 [view setShowsDivider:(opacity > 0 ? YES : NO)];
734 761
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 - (void)hideDropURLsIndicatorInView:(NSView*)view { 823 - (void)hideDropURLsIndicatorInView:(NSView*)view {
797 // Do nothing. 824 // Do nothing.
798 } 825 }
799 826
800 // (URLDropTargetController protocol) 827 // (URLDropTargetController protocol)
801 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 828 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
802 return drag_util::IsUnsupportedDropData(profile_, info); 829 return drag_util::IsUnsupportedDropData(profile_, info);
803 } 830 }
804 831
805 @end 832 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.h ('k') | chrome/browser/ui/global_error_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698