| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 9 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 11 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 12 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 13 #include "content/public/browser/native_web_keyboard_event.h" | 13 #include "content/public/browser/native_web_keyboard_event.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
| 15 #include "ui/events/keycodes/keyboard_codes.h" | 15 #include "ui/events/keycodes/keyboard_codes.h" |
| 16 | 16 |
| 17 using content::NativeWebKeyboardEvent; | 17 using content::NativeWebKeyboardEvent; |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 CGFloat GetPatternVerticalOffsetWithTabStrip(bool tabStripVisible) { | 21 CGFloat GetPatternVerticalOffsetWithTabStrip(bool tabStripVisible) { |
| 22 // Without tab strip, offset an extra pixel (determined by experimentation). | 22 // Without tab strip, offset an extra pixel (determined by experimentation). |
| 23 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 24 return tabStripVisible ? 2 : 3; | |
| 25 } | |
| 26 | |
| 27 return tabStripVisible ? -1 : 0; | 23 return tabStripVisible ? -1 : 0; |
| 28 } | 24 } |
| 29 | 25 |
| 30 } // namespace | 26 } // namespace |
| 31 | 27 |
| 32 | 28 |
| 33 @implementation BrowserWindowUtils | 29 @implementation BrowserWindowUtils |
| 34 + (BOOL)shouldHandleKeyboardEvent:(const NativeWebKeyboardEvent&)event { | 30 + (BOOL)shouldHandleKeyboardEvent:(const NativeWebKeyboardEvent&)event { |
| 35 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) | 31 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) |
| 36 return NO; | 32 return NO; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 140 } |
| 145 | 141 |
| 146 + (void)activateWindowForController:(NSWindowController*)controller { | 142 + (void)activateWindowForController:(NSWindowController*)controller { |
| 147 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to | 143 // Per http://crbug.com/73779 and http://crbug.com/75223, we need this to |
| 148 // properly activate windows if Chrome is not the active application. | 144 // properly activate windows if Chrome is not the active application. |
| 149 [[controller window] makeKeyAndOrderFront:controller]; | 145 [[controller window] makeKeyAndOrderFront:controller]; |
| 150 [NSApp activateIgnoringOtherApps:NO]; | 146 [NSApp activateIgnoringOtherApps:NO]; |
| 151 } | 147 } |
| 152 | 148 |
| 153 @end | 149 @end |
| OLD | NEW |