OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 - (void)allow:(id)sender { | 89 - (void)allow:(id)sender { |
90 // The mouselock code expects that mouse events reach the main window | 90 // The mouselock code expects that mouse events reach the main window |
91 // immediately, but the cursor is still over the bubble, which eats the | 91 // immediately, but the cursor is still over the bubble, which eats the |
92 // mouse events. Make the bubble transparent for mouse events. | 92 // mouse events. Make the bubble transparent for mouse events. |
93 if (bubbleType_ == | 93 if (bubbleType_ == |
94 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS || | 94 EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS || |
95 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS) | 95 bubbleType_ == EXCLUSIVE_ACCESS_BUBBLE_TYPE_MOUSELOCK_BUTTONS) |
96 [[self window] setIgnoresMouseEvents:YES]; | 96 [[self window] setIgnoresMouseEvents:YES]; |
97 | 97 |
98 DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); | 98 DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); |
99 browser_->fullscreen_controller()->OnAcceptFullscreenPermission(); | 99 browser_->exclusive_access_manager()->OnAcceptExclusiveAccessPermission(); |
100 } | 100 } |
101 | 101 |
102 - (void)deny:(id)sender { | 102 - (void)deny:(id)sender { |
103 DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); | 103 DCHECK(exclusive_access_bubble::ShowButtonsForType(bubbleType_)); |
104 browser_->fullscreen_controller()->OnDenyFullscreenPermission(); | 104 browser_->exclusive_access_manager()->OnDenyExclusiveAccessPermission(); |
105 } | 105 } |
106 | 106 |
107 - (void)showButtons:(BOOL)show { | 107 - (void)showButtons:(BOOL)show { |
108 [allowButton_ setHidden:!show]; | 108 [allowButton_ setHidden:!show]; |
109 [denyButton_ setHidden:!show]; | 109 [denyButton_ setHidden:!show]; |
110 [exitLabel_ setHidden:show]; | 110 [exitLabel_ setHidden:show]; |
111 } | 111 } |
112 | 112 |
113 // We want this to be a child of a browser window. addChildWindow: | 113 // We want this to be a child of a browser window. addChildWindow: |
114 // (called from this function) will bring the window on-screen; | 114 // (called from this function) will bring the window on-screen; |
(...skipping 29 matching lines...) Expand all Loading... |
144 origin.x = ownerWindowFrame.origin.x + | 144 origin.x = ownerWindowFrame.origin.x + |
145 (int)(NSWidth(ownerWindowFrame) / 2 - NSWidth(windowFrame) / 2); | 145 (int)(NSWidth(ownerWindowFrame) / 2 - NSWidth(windowFrame) / 2); |
146 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame); | 146 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame); |
147 [[self window] setFrameOrigin:origin]; | 147 [[self window] setFrameOrigin:origin]; |
148 } | 148 } |
149 | 149 |
150 // Called when someone clicks on the embedded link. | 150 // Called when someone clicks on the embedded link. |
151 - (BOOL)textView:(NSTextView*)textView | 151 - (BOOL)textView:(NSTextView*)textView |
152 clickedOnLink:(id)link | 152 clickedOnLink:(id)link |
153 atIndex:(NSUInteger)charIndex { | 153 atIndex:(NSUInteger)charIndex { |
154 browser_->fullscreen_controller() | 154 browser_->exclusive_access_manager() |
155 ->ExitTabOrBrowserFullscreenToPreviousState(); | 155 ->fullscreen_controller() |
| 156 ->ExitExclusiveAccessToPreviousState(); |
156 return YES; | 157 return YES; |
157 } | 158 } |
158 | 159 |
159 - (void)hideTimerFired:(NSTimer*)timer { | 160 - (void)hideTimerFired:(NSTimer*)timer { |
160 // This might fire racily for buttoned bubbles, even though the timer is | 161 // This might fire racily for buttoned bubbles, even though the timer is |
161 // cancelled for them. Explicitly check for this case. | 162 // cancelled for them. Explicitly check for this case. |
162 if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) | 163 if (exclusive_access_bubble::ShowButtonsForType(bubbleType_)) |
163 return; | 164 return; |
164 | 165 |
165 [NSAnimationContext beginGrouping]; | 166 [NSAnimationContext beginGrouping]; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 - (void)hideSoon { | 324 - (void)hideSoon { |
324 hideTimer_.reset( | 325 hideTimer_.reset( |
325 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay | 326 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay |
326 target:self | 327 target:self |
327 selector:@selector(hideTimerFired:) | 328 selector:@selector(hideTimerFired:) |
328 userInfo:nil | 329 userInfo:nil |
329 repeats:NO] retain]); | 330 repeats:NO] retain]); |
330 } | 331 } |
331 | 332 |
332 @end | 333 @end |
OLD | NEW |