| 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/location_bar/autocomplete_text_field_editor.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 6 | 6 |
| 7 #include "base/mac/sdk_forward_declarations.h" | 7 #include "base/mac/sdk_forward_declarations.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" // IDC_* | 10 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| 11 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 15 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 15 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 16 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 16 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 17 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 18 #import "ui/base/cocoa/find_pasteboard.h" | 18 #import "ui/base/cocoa/find_pasteboard.h" |
| 19 #import "ui/base/cocoa/touch_bar_forward_declarations.h" |
| 19 #include "ui/base/l10n/l10n_util_mac.h" | 20 #include "ui/base/l10n/l10n_util_mac.h" |
| 20 #include "ui/base/material_design/material_design_controller.h" | 21 #include "ui/base/material_design/material_design_controller.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // Set to true when an instance of this class is running a nested run loop. | 25 // Set to true when an instance of this class is running a nested run loop. |
| 25 // Since this must always be run on the UI thread, there should never be two | 26 // Since this must always be run on the UI thread, there should never be two |
| 26 // simultaneous drags. | 27 // simultaneous drags. |
| 27 bool gInDrag = false; | 28 bool gInDrag = false; |
| 28 | 29 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // selectively enable them via context menu, but that submenu is not enabled | 72 // selectively enable them via context menu, but that submenu is not enabled |
| 72 // for the omnibox. The substitutions are unlikely to be useful in any case. | 73 // for the omnibox. The substitutions are unlikely to be useful in any case. |
| 73 // | 74 // |
| 74 // Also see http://crbug.com/173405 and http://crbug.com/528014. | 75 // Also see http://crbug.com/173405 and http://crbug.com/528014. |
| 75 NSTextCheckingTypes checkingTypes = 0; | 76 NSTextCheckingTypes checkingTypes = 0; |
| 76 [self setEnabledTextCheckingTypes:checkingTypes]; | 77 [self setEnabledTextCheckingTypes:checkingTypes]; |
| 77 } | 78 } |
| 78 return self; | 79 return self; |
| 79 } | 80 } |
| 80 | 81 |
| 82 // Overridden to prevent unwanted items from appearing in the Touch Bar. |
| 83 - (NSTouchBar*)makeTouchBar { |
| 84 return nil; |
| 85 } |
| 86 |
| 81 - (void)updateColorsToMatchTheme { | 87 - (void)updateColorsToMatchTheme { |
| 82 if (![[self window] inIncognitoMode]) { | 88 if (![[self window] inIncognitoMode]) { |
| 83 return; | 89 return; |
| 84 } | 90 } |
| 85 | 91 |
| 86 bool inDarkMode = [[self window] inIncognitoModeWithSystemTheme]; | 92 bool inDarkMode = [[self window] inIncognitoModeWithSystemTheme]; |
| 87 // Draw a white insertion point for MD Incognito. | 93 // Draw a white insertion point for MD Incognito. |
| 88 NSColor* insertionPointColor = | 94 NSColor* insertionPointColor = |
| 89 inDarkMode ? [NSColor whiteColor] : [NSColor blackColor]; | 95 inDarkMode ? [NSColor whiteColor] : [NSColor blackColor]; |
| 90 [self setInsertionPointColor:insertionPointColor]; | 96 [self setInsertionPointColor:insertionPointColor]; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // ThemedWindowDrawing implementation. | 606 // ThemedWindowDrawing implementation. |
| 601 | 607 |
| 602 - (void)windowDidChangeTheme { | 608 - (void)windowDidChangeTheme { |
| 603 [self updateColorsToMatchTheme]; | 609 [self updateColorsToMatchTheme]; |
| 604 } | 610 } |
| 605 | 611 |
| 606 - (void)windowDidChangeActive { | 612 - (void)windowDidChangeActive { |
| 607 } | 613 } |
| 608 | 614 |
| 609 @end | 615 @end |
| OLD | NEW |