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); | |
553 omnibox_view_->OpenMatch(match, disposition, GURL(), row, | 551 omnibox_view_->OpenMatch(match, disposition, GURL(), row, |
554 is_keyword_hint ? string16() : keyword); | 552 match.keyword); |
555 } | 553 } |
556 | 554 |
557 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { | 555 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { |
558 PromoCounter* counter = profile_->GetInstantPromoCounter(); | 556 PromoCounter* counter = profile_->GetInstantPromoCounter(); |
559 DCHECK(counter); | 557 DCHECK(counter); |
560 counter->Hide(); | 558 counter->Hide(); |
561 if (opt_in) { | 559 if (opt_in) { |
562 browser::ShowInstantConfirmDialogIfNecessary([field_ window], profile_); | 560 browser::ShowInstantConfirmDialogIfNecessary([field_ window], profile_); |
563 } | 561 } |
564 | 562 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 bottomLeftCornerRadius:kPopupRoundingRadius | 823 bottomLeftCornerRadius:kPopupRoundingRadius |
826 bottomRightCornerRadius:kPopupRoundingRadius]; | 824 bottomRightCornerRadius:kPopupRoundingRadius]; |
827 | 825 |
828 // Draw the matrix clipped to our border. | 826 // Draw the matrix clipped to our border. |
829 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 827 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
830 [path addClip]; | 828 [path addClip]; |
831 [super drawRect:rect]; | 829 [super drawRect:rect]; |
832 } | 830 } |
833 | 831 |
834 @end | 832 @end |
OLD | NEW |