| 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.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #import "base/mac/sdk_forward_declarations.h" | 9 #import "base/mac/sdk_forward_declarations.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 name:NSWindowDidResizeNotification | 362 name:NSWindowDidResizeNotification |
| 363 object:[self window]]; | 363 object:[self window]]; |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 - (void)viewDidMoveToWindow { | 367 - (void)viewDidMoveToWindow { |
| 368 if (![self window]) { | 368 if (![self window]) { |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 | 371 |
| 372 // Allow the ToolbarController to take action upon the |
| 373 // AutocompleteTextField being added to the window. |
| 374 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 375 BrowserWindowController* browserWindowController = |
| 376 [BrowserWindowController browserWindowControllerForView:self]; |
| 377 [[browserWindowController toolbarController] locationBarWasAddedToWindow]; |
| 378 } |
| 379 |
| 372 // Invert the textfield's colors when Material Design and Incognito and not | 380 // Invert the textfield's colors when Material Design and Incognito and not |
| 373 // a custom theme. | 381 // a custom theme. |
| 374 if (ui::MaterialDesignController::IsModeMaterial() && | 382 if (ui::MaterialDesignController::IsModeMaterial() && |
| 375 [[self window] inIncognitoModeWithSystemTheme]) { | 383 [[self window] inIncognitoModeWithSystemTheme]) { |
| 376 [self setTextColor:[NSColor whiteColor]]; | 384 [self setTextColor:[NSColor whiteColor]]; |
| 377 [self setBackgroundColor: | 385 [self setBackgroundColor: |
| 378 [NSColor colorWithCalibratedWhite:115 / 255. alpha:1]]; | 386 [NSColor colorWithCalibratedWhite:115 / 255. alpha:1]]; |
| 379 } | 387 } |
| 380 | 388 |
| 381 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 389 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 NSMinY(frame), | 541 NSMinY(frame), |
| 534 suggestWidth, | 542 suggestWidth, |
| 535 NSHeight(frame)); | 543 NSHeight(frame)); |
| 536 | 544 |
| 537 gfx::ScopedNSGraphicsContextSaveGState saveGState; | 545 gfx::ScopedNSGraphicsContextSaveGState saveGState; |
| 538 NSRectClip(suggestRect); | 546 NSRectClip(suggestRect); |
| 539 [cell drawInteriorWithFrame:frame inView:controlView]; | 547 [cell drawInteriorWithFrame:frame inView:controlView]; |
| 540 } | 548 } |
| 541 | 549 |
| 542 } // namespace autocomplete_text_field | 550 } // namespace autocomplete_text_field |
| OLD | NEW |