| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 [self setTextColor:OmniboxViewMac::BaseTextColor(inDarkMode)]; | 393 [self setTextColor:OmniboxViewMac::BaseTextColor(inDarkMode)]; |
| 394 } | 394 } |
| 395 | 395 |
| 396 - (void)viewDidMoveToWindow { | 396 - (void)viewDidMoveToWindow { |
| 397 if (![self window]) { | 397 if (![self window]) { |
| 398 return; | 398 return; |
| 399 } | 399 } |
| 400 | 400 |
| 401 // Allow the ToolbarController to take action upon the | 401 // Allow the ToolbarController to take action upon the |
| 402 // AutocompleteTextField being added to the window. | 402 // AutocompleteTextField being added to the window. |
| 403 if (ui::MaterialDesignController::IsModeMaterial()) { | 403 BrowserWindowController* browserWindowController = |
| 404 BrowserWindowController* browserWindowController = | 404 [BrowserWindowController browserWindowControllerForView:self]; |
| 405 [BrowserWindowController browserWindowControllerForView:self]; | 405 [[browserWindowController toolbarController] locationBarWasAddedToWindow]; |
| 406 [[browserWindowController toolbarController] locationBarWasAddedToWindow]; | |
| 407 | 406 |
| 408 [self updateColorsToMatchTheme]; | 407 [self updateColorsToMatchTheme]; |
| 409 } | |
| 410 | 408 |
| 411 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; | 409 NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; |
| 412 [nc addObserver:self | 410 [nc addObserver:self |
| 413 selector:@selector(windowDidResignKey:) | 411 selector:@selector(windowDidResignKey:) |
| 414 name:NSWindowDidResignKeyNotification | 412 name:NSWindowDidResignKeyNotification |
| 415 object:[self window]]; | 413 object:[self window]]; |
| 416 [nc addObserver:self | 414 [nc addObserver:self |
| 417 selector:@selector(windowDidResize:) | 415 selector:@selector(windowDidResize:) |
| 418 name:NSWindowDidResizeNotification | 416 name:NSWindowDidResizeNotification |
| 419 object:[self window]]; | 417 object:[self window]]; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; | 543 return [cell decorationMenuForEvent:event inRect:[self bounds] ofView:self]; |
| 546 } | 544 } |
| 547 | 545 |
| 548 - (ViewID)viewID { | 546 - (ViewID)viewID { |
| 549 return VIEW_ID_OMNIBOX; | 547 return VIEW_ID_OMNIBOX; |
| 550 } | 548 } |
| 551 | 549 |
| 552 // ThemedWindowDrawing implementation. | 550 // ThemedWindowDrawing implementation. |
| 553 | 551 |
| 554 - (void)windowDidChangeTheme { | 552 - (void)windowDidChangeTheme { |
| 555 if (!ui::MaterialDesignController::IsModeMaterial()) { | |
| 556 return; | |
| 557 } | |
| 558 | |
| 559 [self updateColorsToMatchTheme]; | 553 [self updateColorsToMatchTheme]; |
| 560 } | 554 } |
| 561 | 555 |
| 562 - (void)windowDidChangeActive { | 556 - (void)windowDidChangeActive { |
| 563 } | 557 } |
| 564 | 558 |
| 565 @end | 559 @end |
| 566 | 560 |
| 567 namespace autocomplete_text_field { | 561 namespace autocomplete_text_field { |
| 568 | 562 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 595 NSMinY(frame), | 589 NSMinY(frame), |
| 596 suggestWidth, | 590 suggestWidth, |
| 597 NSHeight(frame)); | 591 NSHeight(frame)); |
| 598 | 592 |
| 599 gfx::ScopedNSGraphicsContextSaveGState saveGState; | 593 gfx::ScopedNSGraphicsContextSaveGState saveGState; |
| 600 NSRectClip(suggestRect); | 594 NSRectClip(suggestRect); |
| 601 [cell drawInteriorWithFrame:frame inView:controlView]; | 595 [cell drawInteriorWithFrame:frame inView:controlView]; |
| 602 } | 596 } |
| 603 | 597 |
| 604 } // namespace autocomplete_text_field | 598 } // namespace autocomplete_text_field |
| OLD | NEW |