| 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 "chrome/browser/ui/cocoa/applescript/window_applescript.h" | 5 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
| 11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 12 #import "chrome/browser/app_controller_mac.h" | 13 #import "chrome/browser/app_controller_mac.h" |
| 13 #import "chrome/browser/chrome_browser_application_mac.h" | 14 #import "chrome/browser/chrome_browser_application_mac.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 19 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/browser_navigator_params.h" | 20 #include "chrome/browser/ui/browser_navigator_params.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 - (NSWindow*)nativeHandle; | 36 - (NSWindow*)nativeHandle; |
| 36 @end | 37 @end |
| 37 | 38 |
| 38 @implementation WindowAppleScript | 39 @implementation WindowAppleScript |
| 39 | 40 |
| 40 - (id)init { | 41 - (id)init { |
| 41 // Check which mode to open a new window. | 42 // Check which mode to open a new window. |
| 42 NSScriptCommand* command = [NSScriptCommand currentCommand]; | 43 NSScriptCommand* command = [NSScriptCommand currentCommand]; |
| 43 NSString* mode = [[[command evaluatedArguments] | 44 NSString* mode = [[[command evaluatedArguments] |
| 44 objectForKey:@"KeyDictionary"] objectForKey:@"mode"]; | 45 objectForKey:@"KeyDictionary"] objectForKey:@"mode"]; |
| 45 AppController* appDelegate = [NSApp delegate]; | 46 AppController* appDelegate = |
| 47 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
| 46 | 48 |
| 47 Profile* lastProfile = [appDelegate lastProfile]; | 49 Profile* lastProfile = [appDelegate lastProfile]; |
| 48 | 50 |
| 49 if (!lastProfile) { | 51 if (!lastProfile) { |
| 50 AppleScript::SetError(AppleScript::errGetProfile); | 52 AppleScript::SetError(AppleScript::errGetProfile); |
| 51 return nil; | 53 return nil; |
| 52 } | 54 } |
| 53 | 55 |
| 54 Profile* profile; | 56 Profile* profile; |
| 55 if ([mode isEqualToString:AppleScript::kIncognitoWindowMode]) { | 57 if ([mode isEqualToString:AppleScript::kIncognitoWindowMode]) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION, false); | 275 GURL(), EXCLUSIVE_ACCESS_BUBBLE_TYPE_FULLSCREEN_EXIT_INSTRUCTION, false); |
| 274 } | 276 } |
| 275 | 277 |
| 276 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { | 278 - (void)handlesExitPresentationMode:(NSScriptCommand*)command { |
| 277 AppleScript::LogAppleScriptUMA( | 279 AppleScript::LogAppleScriptUMA( |
| 278 AppleScript::AppleScriptCommand::WINDOW_EXIT_PRESENTATION_MODE); | 280 AppleScript::AppleScriptCommand::WINDOW_EXIT_PRESENTATION_MODE); |
| 279 browser_->exclusive_access_manager()->context()->ExitFullscreen(); | 281 browser_->exclusive_access_manager()->context()->ExitFullscreen(); |
| 280 } | 282 } |
| 281 | 283 |
| 282 @end | 284 @end |
| OLD | NEW |