OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_window_utils.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | |
8 | |
9 #include "base/logging.h" | 7 #include "base/logging.h" |
10 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
12 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
13 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 11 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
14 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
15 #include "content/public/browser/native_web_keyboard_event.h" | 13 #include "content/public/browser/native_web_keyboard_event.h" |
16 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
17 #include "ui/events/keycodes/keyboard_codes.h" | 15 #include "ui/events/keycodes/keyboard_codes.h" |
18 | 16 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // the window's root view when not in presentation mode. | 140 // the window's root view when not in presentation mode. |
143 return NSMakePoint(kPatternHorizontalOffset, | 141 return NSMakePoint(kPatternHorizontalOffset, |
144 NSHeight([tabStripView bounds]) + | 142 NSHeight([tabStripView bounds]) + |
145 GetPatternVerticalOffsetWithTabStrip(false)); | 143 GetPatternVerticalOffsetWithTabStrip(false)); |
146 } | 144 } |
147 | 145 |
148 + (void)activateWindowForController:(NSWindowController*)controller { | 146 + (void)activateWindowForController:(NSWindowController*)controller { |
149 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to | 147 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to |
150 // properly activate windows if Chrome is not the active application. | 148 // properly activate windows if Chrome is not the active application. |
151 [[controller window] makeKeyAndOrderFront:controller]; | 149 [[controller window] makeKeyAndOrderFront:controller]; |
152 ProcessSerialNumber psn; | 150 [[NSRunningApplication currentApplication] activateWithOptions:0]; |
153 GetCurrentProcess(&psn); | |
154 SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly); | |
155 } | 151 } |
156 | 152 |
157 @end | 153 @end |
OLD | NEW |