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

Side by Side Diff: chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.mm

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h"
14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 15 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
15 #include "chrome/browser/ui/cocoa/event_utils.h" 16 #include "chrome/browser/ui/cocoa/event_utils.h"
16 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h" 17 #import "chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller.h"
17 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" 18 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h"
18 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 19 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
19 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
20 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" 21 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents.h" 23 #include "chrome/browser/ui/tab_contents/tab_contents.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 origin.x = ownerWindowFrame.origin.x + 144 origin.x = ownerWindowFrame.origin.x +
144 (int)(NSWidth(ownerWindowFrame)/2 - NSWidth(windowFrame)/2); 145 (int)(NSWidth(ownerWindowFrame)/2 - NSWidth(windowFrame)/2);
145 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame); 146 origin.y = ownerWindowFrame.origin.y + maxY - NSHeight(windowFrame);
146 [[self window] setFrameOrigin:origin]; 147 [[self window] setFrameOrigin:origin];
147 } 148 }
148 149
149 // Called when someone clicks on the embedded link. 150 // Called when someone clicks on the embedded link.
150 - (BOOL) textView:(NSTextView*)textView 151 - (BOOL) textView:(NSTextView*)textView
151 clickedOnLink:(id)link 152 clickedOnLink:(id)link
152 atIndex:(NSUInteger)charIndex { 153 atIndex:(NSUInteger)charIndex {
153 browser_->ExecuteCommand(IDC_FULLSCREEN); 154 chrome::ExecuteCommand(browser_, IDC_FULLSCREEN);
154 return YES; 155 return YES;
155 } 156 }
156 157
157 - (void)hideTimerFired:(NSTimer*)timer { 158 - (void)hideTimerFired:(NSTimer*)timer {
158 // This might fire racily for buttoned bubbles, even though the timer is 159 // This might fire racily for buttoned bubbles, even though the timer is
159 // cancelled for them. Explicitly check for this case. 160 // cancelled for them. Explicitly check for this case.
160 if (fullscreen_bubble::ShowButtonsForType(bubbleType_)) 161 if (fullscreen_bubble::ShowButtonsForType(bubbleType_))
161 return; 162 return;
162 163
163 [NSAnimationContext beginGrouping]; 164 [NSAnimationContext beginGrouping];
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 - (void)hideSoon { 301 - (void)hideSoon {
301 hideTimer_.reset( 302 hideTimer_.reset(
302 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay 303 [[NSTimer scheduledTimerWithTimeInterval:kInitialDelay
303 target:self 304 target:self
304 selector:@selector(hideTimerFired:) 305 selector:@selector(hideTimerFired:)
305 userInfo:nil 306 userInfo:nil
306 repeats:NO] retain]); 307 repeats:NO] retain]);
307 } 308 }
308 309
309 @end 310 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698