| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" | 5 #import "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 EXPECT_TRUE([dialog_widget->GetNativeWindow() canBecomeKeyWindow]); | 1368 EXPECT_TRUE([dialog_widget->GetNativeWindow() canBecomeKeyWindow]); |
| 1369 // Dialogs shouldn't take main status away from their parent. | 1369 // Dialogs shouldn't take main status away from their parent. |
| 1370 EXPECT_FALSE([dialog_widget->GetNativeWindow() canBecomeMainWindow]); | 1370 EXPECT_FALSE([dialog_widget->GetNativeWindow() canBecomeMainWindow]); |
| 1371 | 1371 |
| 1372 // Create a bubble widget with a parent: also shouldn't get main. | 1372 // Create a bubble widget with a parent: also shouldn't get main. |
| 1373 BubbleDialogDelegateView* bubble_view = new SimpleBubbleView(); | 1373 BubbleDialogDelegateView* bubble_view = new SimpleBubbleView(); |
| 1374 bubble_view->set_parent_window(regular_widget->GetNativeView()); | 1374 bubble_view->set_parent_window(regular_widget->GetNativeView()); |
| 1375 Widget* bubble_widget = BubbleDialogDelegateView::CreateBubble(bubble_view); | 1375 Widget* bubble_widget = BubbleDialogDelegateView::CreateBubble(bubble_view); |
| 1376 EXPECT_TRUE([bubble_widget->GetNativeWindow() canBecomeKeyWindow]); | 1376 EXPECT_TRUE([bubble_widget->GetNativeWindow() canBecomeKeyWindow]); |
| 1377 EXPECT_FALSE([bubble_widget->GetNativeWindow() canBecomeMainWindow]); | 1377 EXPECT_FALSE([bubble_widget->GetNativeWindow() canBecomeMainWindow]); |
| 1378 EXPECT_EQ(NSWindowCollectionBehaviorTransient, |
| 1379 [bubble_widget->GetNativeWindow() collectionBehavior] & |
| 1380 NSWindowCollectionBehaviorTransient); |
| 1378 | 1381 |
| 1379 // But a bubble without a parent should still be able to become main. | 1382 // But a bubble without a parent should still be able to become main. |
| 1380 Widget* toplevel_bubble_widget = | 1383 Widget* toplevel_bubble_widget = |
| 1381 BubbleDialogDelegateView::CreateBubble(new SimpleBubbleView()); | 1384 BubbleDialogDelegateView::CreateBubble(new SimpleBubbleView()); |
| 1382 EXPECT_TRUE([toplevel_bubble_widget->GetNativeWindow() canBecomeKeyWindow]); | 1385 EXPECT_TRUE([toplevel_bubble_widget->GetNativeWindow() canBecomeKeyWindow]); |
| 1383 EXPECT_TRUE([toplevel_bubble_widget->GetNativeWindow() canBecomeMainWindow]); | 1386 EXPECT_TRUE([toplevel_bubble_widget->GetNativeWindow() canBecomeMainWindow]); |
| 1384 | 1387 |
| 1385 toplevel_bubble_widget->CloseNow(); | 1388 toplevel_bubble_widget->CloseNow(); |
| 1386 regular_widget->CloseNow(); | 1389 regular_widget->CloseNow(); |
| 1387 } | 1390 } |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 | 1931 |
| 1929 - (void)dealloc { | 1932 - (void)dealloc { |
| 1930 if (deallocFlag_) { | 1933 if (deallocFlag_) { |
| 1931 DCHECK(!*deallocFlag_); | 1934 DCHECK(!*deallocFlag_); |
| 1932 *deallocFlag_ = true; | 1935 *deallocFlag_ = true; |
| 1933 } | 1936 } |
| 1934 [super dealloc]; | 1937 [super dealloc]; |
| 1935 } | 1938 } |
| 1936 | 1939 |
| 1937 @end | 1940 @end |
| OLD | NEW |