| 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_* |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 NSBackgroundColorAttributeName : textSelectionColor | 100 NSBackgroundColorAttributeName : textSelectionColor |
| 101 }]; | 101 }]; |
| 102 } else { | 102 } else { |
| 103 [self setSelectedTextAttributes:@{ | 103 [self setSelectedTextAttributes:@{ |
| 104 NSBackgroundColorAttributeName : textSelectionColor | 104 NSBackgroundColorAttributeName : textSelectionColor |
| 105 }]; | 105 }]; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 - (void)viewDidMoveToWindow { | 109 - (void)viewDidMoveToWindow { |
| 110 // Only care about landing in a window when in Material Design mode. | 110 // Only care about landing in a window. |
| 111 if ([self window] && ui::MaterialDesignController::IsModeMaterial()) { | 111 if ([self window]) { |
| 112 [self updateColorsToMatchTheme]; | 112 [self updateColorsToMatchTheme]; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 // If the entire field is selected, drag the same data as would be | 116 // If the entire field is selected, drag the same data as would be |
| 117 // dragged from the field's location icon. In some cases the textual | 117 // dragged from the field's location icon. In some cases the textual |
| 118 // contents will not contain relevant data (for instance, "http://" is | 118 // contents will not contain relevant data (for instance, "http://" is |
| 119 // stripped from URLs). | 119 // stripped from URLs). |
| 120 - (BOOL)dragSelectionWithEvent:(NSEvent *)event | 120 - (BOOL)dragSelectionWithEvent:(NSEvent *)event |
| 121 offset:(NSSize)mouseOffset | 121 offset:(NSSize)mouseOffset |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 self, | 597 self, |
| 598 [self bounds]); | 598 [self bounds]); |
| 599 AutocompleteTextFieldObserver* observer = [self observer]; | 599 AutocompleteTextFieldObserver* observer = [self observer]; |
| 600 if (observer) | 600 if (observer) |
| 601 observer->OnDidDrawRect(); | 601 observer->OnDidDrawRect(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 // ThemedWindowDrawing implementation. | 604 // ThemedWindowDrawing implementation. |
| 605 | 605 |
| 606 - (void)windowDidChangeTheme { | 606 - (void)windowDidChangeTheme { |
| 607 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 608 return; | |
| 609 } | |
| 610 [self updateColorsToMatchTheme]; | 607 [self updateColorsToMatchTheme]; |
| 611 } | 608 } |
| 612 | 609 |
| 613 - (void)windowDidChangeActive { | 610 - (void)windowDidChangeActive { |
| 614 } | 611 } |
| 615 | 612 |
| 616 @end | 613 @end |
| OLD | NEW |