OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 if (!force_background) { | 541 if (!force_background) { |
542 disposition = | 542 disposition = |
543 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 543 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
544 } | 544 } |
545 | 545 |
546 // OpenMatch() may close the popup, which will clear the result set | 546 // OpenMatch() may close the popup, which will clear the result set |
547 // and, by extension, |match| and its contents. So copy the | 547 // and, by extension, |match| and its contents. So copy the |
548 // relevant match out to make sure it stays alive until the call | 548 // relevant match out to make sure it stays alive until the call |
549 // completes. | 549 // completes. |
550 AutocompleteMatch match = model_->result().match_at(row); | 550 AutocompleteMatch match = model_->result().match_at(row); |
| 551 string16 keyword; |
| 552 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); |
551 omnibox_view_->OpenMatch(match, disposition, GURL(), row, | 553 omnibox_view_->OpenMatch(match, disposition, GURL(), row, |
552 match.keyword); | 554 is_keyword_hint ? string16() : keyword); |
553 } | 555 } |
554 | 556 |
555 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { | 557 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { |
556 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 558 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
557 DCHECK(counter); | 559 DCHECK(counter); |
558 counter->Hide(); | 560 counter->Hide(); |
559 if (opt_in) { | 561 if (opt_in) { |
560 browser::ShowInstantConfirmDialogIfNecessary([field_ window], profile_); | 562 browser::ShowInstantConfirmDialogIfNecessary([field_ window], profile_); |
561 } | 563 } |
562 | 564 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 bottomLeftCornerRadius:kPopupRoundingRadius | 825 bottomLeftCornerRadius:kPopupRoundingRadius |
824 bottomRightCornerRadius:kPopupRoundingRadius]; | 826 bottomRightCornerRadius:kPopupRoundingRadius]; |
825 | 827 |
826 // Draw the matrix clipped to our border. | 828 // Draw the matrix clipped to our border. |
827 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 829 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
828 [path addClip]; | 830 [path addClip]; |
829 [super drawRect:rect]; | 831 [super drawRect:rect]; |
830 } | 832 } |
831 | 833 |
832 @end | 834 @end |
OLD | NEW |