Fix not to close the bubble when entering full screen.

Listen to the full screen event, then if so, close the bubble.

BUG=326081

Review URL: https://codereview.chromium.org/320393005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278385 0039d316-1c4b-4281-b951-d872f2087c98
parent 5ff2851a
...@@ -227,6 +227,7 @@ Luke Zarko <lukezarko@gmail.com> ...@@ -227,6 +227,7 @@ Luke Zarko <lukezarko@gmail.com>
Maarten Lankhorst <m.b.lankhorst@gmail.com> Maarten Lankhorst <m.b.lankhorst@gmail.com>
Magnus Danielsson <fuzzac@gmail.com> Magnus Danielsson <fuzzac@gmail.com>
Mahesh Kulkarni <mahesh.kk@samsung.com> Mahesh Kulkarni <mahesh.kk@samsung.com>
Malcolm Wang <malcolm.2.wang@gmail.com>
Manuel Braun <thembrown@gmail.com> Manuel Braun <thembrown@gmail.com>
Mao Yujie <maojie0924@gmail.com> Mao Yujie <maojie0924@gmail.com>
Mao Yujie <yujie.mao@intel.com> Mao Yujie <yujie.mao@intel.com>
......
...@@ -308,6 +308,7 @@ ...@@ -308,6 +308,7 @@
'mac/scoped_sending_event.mm', 'mac/scoped_sending_event.mm',
'mac/scoped_typeref.h', 'mac/scoped_typeref.h',
'mac/sdk_forward_declarations.h', 'mac/sdk_forward_declarations.h',
'mac/sdk_forward_declarations.mm',
'macros.h', 'macros.h',
'md5.cc', 'md5.cc',
'md5.h', 'md5.h',
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#import <ImageCaptureCore/ImageCaptureCore.h> #import <ImageCaptureCore/ImageCaptureCore.h>
#import <IOBluetooth/IOBluetooth.h> #import <IOBluetooth/IOBluetooth.h>
#include "base/base_export.h"
#if !defined(MAC_OS_X_VERSION_10_7) || \ #if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
...@@ -180,8 +182,9 @@ enum CWChannelBand { ...@@ -180,8 +182,9 @@ enum CWChannelBand {
- (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids; - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
@end @end
#endif // MAC_OS_X_VERSION_10_7 BASE_EXPORT extern "C" NSString* const NSWindowWillEnterFullScreenNotification;
#endif // MAC_OS_X_VERSION_10_7
#if !defined(MAC_OS_X_VERSION_10_8) || \ #if !defined(MAC_OS_X_VERSION_10_8) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/mac/sdk_forward_declarations.h"
// Replicate specific 10.7 SDK declarations for building with prior SDKs.
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
NSString* const NSWindowWillEnterFullScreenNotification =
@"NSWindowWillEnterFullScreenNotification";
#endif // MAC_OS_X_VERSION_10_7
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/mac/bundle_locations.h" #include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/mac/sdk_forward_declarations.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h" #import "chrome/browser/ui/cocoa/info_bubble_view.h"
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
- (void)recordAnchorOffset; - (void)recordAnchorOffset;
- (void)parentWindowDidResize:(NSNotification*)notification; - (void)parentWindowDidResize:(NSNotification*)notification;
- (void)parentWindowWillClose:(NSNotification*)notification; - (void)parentWindowWillClose:(NSNotification*)notification;
- (void)parentWindowWillBecomeFullScreen:(NSNotification*)notification;
- (void)closeCleanup; - (void)closeCleanup;
@end @end
...@@ -119,6 +121,11 @@ ...@@ -119,6 +121,11 @@
selector:@selector(parentWindowWillClose:) selector:@selector(parentWindowWillClose:)
name:NSWindowWillCloseNotification name:NSWindowWillCloseNotification
object:parentWindow_]; object:parentWindow_];
// Watch for the full screen event, if so, close the bubble
[center addObserver:self
selector:@selector(parentWindowWillBecomeFullScreen:)
name:NSWindowWillEnterFullScreenNotification
object:parentWindow_];
// Watch for parent window's resizing, to ensure this one is always // Watch for parent window's resizing, to ensure this one is always
// anchored correctly. // anchored correctly.
[center addObserver:self [center addObserver:self
...@@ -151,6 +158,9 @@ ...@@ -151,6 +158,9 @@
} }
- (void)parentWindowDidResize:(NSNotification*)notification { - (void)parentWindowDidResize:(NSNotification*)notification {
if (!parentWindow_)
return;
DCHECK_EQ(parentWindow_, [notification object]); DCHECK_EQ(parentWindow_, [notification object]);
NSPoint newOrigin = NSMakePoint(NSMinX([parentWindow_ frame]), NSPoint newOrigin = NSMakePoint(NSMinX([parentWindow_ frame]),
NSMaxY([parentWindow_ frame])); NSMaxY([parentWindow_ frame]));
...@@ -164,6 +174,11 @@ ...@@ -164,6 +174,11 @@
[self close]; [self close];
} }
- (void)parentWindowWillBecomeFullScreen:(NSNotification*)notification {
parentWindow_ = nil;
[self close];
}
- (void)closeCleanup { - (void)closeCleanup {
if (eventTap_) { if (eventTap_) {
[NSEvent removeMonitor:eventTap_]; [NSEvent removeMonitor:eventTap_];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment