diff options
author | malcolm.2.wang@gmail.com <malcolm.2.wang@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 15:28:40 +0000 |
---|---|---|
committer | malcolm.2.wang@gmail.com <malcolm.2.wang@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 15:28:40 +0000 |
commit | 06d02b11b0bf54ea3a5ab9735626367607e5f122 (patch) | |
tree | 11a856a9e0bf48b15cea70d89988fa66144f4ac1 | |
parent | 5ff2851a231ac2a70c6fc7a4bd5907bcfa9d1366 (diff) | |
download | chromium_src-06d02b11b0bf54ea3a5ab9735626367607e5f122.zip chromium_src-06d02b11b0bf54ea3a5ab9735626367607e5f122.tar.gz chromium_src-06d02b11b0bf54ea3a5ab9735626367607e5f122.tar.bz2 |
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
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | base/base.gypi | 1 | ||||
-rw-r--r-- | base/mac/sdk_forward_declarations.h | 5 | ||||
-rw-r--r-- | base/mac/sdk_forward_declarations.mm | 14 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/base_bubble_controller.mm | 15 |
5 files changed, 35 insertions, 1 deletions
@@ -227,6 +227,7 @@ Luke Zarko <lukezarko@gmail.com> Maarten Lankhorst <m.b.lankhorst@gmail.com> Magnus Danielsson <fuzzac@gmail.com> Mahesh Kulkarni <mahesh.kk@samsung.com> +Malcolm Wang <malcolm.2.wang@gmail.com> Manuel Braun <thembrown@gmail.com> Mao Yujie <maojie0924@gmail.com> Mao Yujie <yujie.mao@intel.com> diff --git a/base/base.gypi b/base/base.gypi index 8c603a7..c033dcb 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -308,6 +308,7 @@ 'mac/scoped_sending_event.mm', 'mac/scoped_typeref.h', 'mac/sdk_forward_declarations.h', + 'mac/sdk_forward_declarations.mm', 'macros.h', 'md5.cc', 'md5.h', diff --git a/base/mac/sdk_forward_declarations.h b/base/mac/sdk_forward_declarations.h index e53fdbd..3a0878da 100644 --- a/base/mac/sdk_forward_declarations.h +++ b/base/mac/sdk_forward_declarations.h @@ -16,6 +16,8 @@ #import <ImageCaptureCore/ImageCaptureCore.h> #import <IOBluetooth/IOBluetooth.h> +#include "base/base_export.h" + #if !defined(MAC_OS_X_VERSION_10_7) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 @@ -180,8 +182,9 @@ enum CWChannelBand { - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids; @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) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8 diff --git a/base/mac/sdk_forward_declarations.mm b/base/mac/sdk_forward_declarations.mm new file mode 100644 index 0000000..a402a41 --- /dev/null +++ b/base/mac/sdk_forward_declarations.mm @@ -0,0 +1,14 @@ +// 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 diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm index 2628f05..fd19a0d 100644 --- a/chrome/browser/ui/cocoa/base_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm @@ -8,6 +8,7 @@ #include "base/mac/bundle_locations.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_nsobject.h" +#include "base/mac/sdk_forward_declarations.h" #include "base/strings/string_util.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/info_bubble_view.h" @@ -25,6 +26,7 @@ - (void)recordAnchorOffset; - (void)parentWindowDidResize:(NSNotification*)notification; - (void)parentWindowWillClose:(NSNotification*)notification; +- (void)parentWindowWillBecomeFullScreen:(NSNotification*)notification; - (void)closeCleanup; @end @@ -119,6 +121,11 @@ selector:@selector(parentWindowWillClose:) name:NSWindowWillCloseNotification 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 // anchored correctly. [center addObserver:self @@ -151,6 +158,9 @@ } - (void)parentWindowDidResize:(NSNotification*)notification { + if (!parentWindow_) + return; + DCHECK_EQ(parentWindow_, [notification object]); NSPoint newOrigin = NSMakePoint(NSMinX([parentWindow_ frame]), NSMaxY([parentWindow_ frame])); @@ -164,6 +174,11 @@ [self close]; } +- (void)parentWindowWillBecomeFullScreen:(NSNotification*)notification { + parentWindow_ = nil; + [self close]; +} + - (void)closeCleanup { if (eventTap_) { [NSEvent removeMonitor:eventTap_]; |