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

Unified Diff: chrome/browser/cocoa/popup_blocked_animation_mac.mm

Issue 3014029: [Mac] Make popup-blocked animation animate to content-setting icon. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: rsesek comments. Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/location_bar/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/popup_blocked_animation_mac.mm
diff --git a/chrome/browser/cocoa/popup_blocked_animation_mac.mm b/chrome/browser/cocoa/popup_blocked_animation_mac.mm
index cee68123611492eb56b868d711006151454ff49b..d0f5644999bd54c2c89b9a9fc62846427390bec8 100644
--- a/chrome/browser/cocoa/popup_blocked_animation_mac.mm
+++ b/chrome/browser/cocoa/popup_blocked_animation_mac.mm
@@ -9,6 +9,8 @@
#import "base/nsimage_cache_mac.h"
#import "chrome/browser/cocoa/animatable_image.h"
+#import "chrome/browser/cocoa/browser_window_controller.h"
+#import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
@@ -116,9 +118,28 @@ class PopupBlockedAnimationObserver : public NotificationObserver {
// slightly to the Omnibox. While the geometry won't align perfectly, it's
// close enough for the user to take note of the new icon. These numbers
// come from measuring the Omnibox without any page actions.
- [animation_ setEndFrame:CGRectMake(animationFrame.size.width - 115,
- animationFrame.size.height - 50,
- 16, 16)];
+ CGRect endFrame = CGRectMake(animationFrame.size.width - 115,
+ animationFrame.size.height - 50,
+ 16, 16);
+
+ // If the location-bar can be found, ask it for better
+ // coordinates.
+ BrowserWindowController* bwc = [parentWindow windowController];
+ if ([bwc isKindOfClass:[BrowserWindowController class]]) {
+ LocationBarViewMac* lbvm = [bwc locationBarBridge];
+ if (lbvm) {
+ NSRect frame = lbvm->GetBlockedPopupRect();
+ if (!NSIsEmptyRect(frame)) {
+ // Convert up to the screen, then back down to the animation
+ // window.
+ NSPoint screenPoint = [parentWindow convertBaseToScreen:frame.origin];
+ frame.origin = [animation_ convertScreenToBase:screenPoint];
+ endFrame = NSRectToCGRect(frame);
+ }
+ }
+ }
+
+ [animation_ setEndFrame:endFrame];
[animation_ setStartOpacity:1.0];
[animation_ setEndOpacity:0.2];
[animation_ setDuration:0.7];
« no previous file with comments | « chrome/browser/cocoa/location_bar/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698