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 #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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 if (!force_background) { | 535 if (!force_background) { |
536 disposition = | 536 disposition = |
537 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); | 537 event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); |
538 } | 538 } |
539 | 539 |
540 // OpenMatch() may close the popup, which will clear the result set | 540 // OpenMatch() may close the popup, which will clear the result set |
541 // and, by extension, |match| and its contents. So copy the | 541 // and, by extension, |match| and its contents. So copy the |
542 // relevant match out to make sure it stays alive until the call | 542 // relevant match out to make sure it stays alive until the call |
543 // completes. | 543 // completes. |
544 AutocompleteMatch match = model_->result().match_at(row); | 544 AutocompleteMatch match = model_->result().match_at(row); |
545 string16 keyword; | |
546 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); | |
547 omnibox_view_->OpenMatch(match, disposition, GURL(), row, | 545 omnibox_view_->OpenMatch(match, disposition, GURL(), row, |
548 is_keyword_hint ? string16() : keyword); | 546 match.keyword); |
549 } | 547 } |
550 | 548 |
551 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { | 549 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { |
552 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); | 550 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); |
553 DCHECK(counter); | 551 DCHECK(counter); |
554 counter->Hide(); | 552 counter->Hide(); |
555 if (opt_in) { | 553 if (opt_in) { |
556 browser::ShowInstantConfirmDialogIfNecessary([field_ window], | 554 browser::ShowInstantConfirmDialogIfNecessary([field_ window], |
557 model_->profile()); | 555 model_->profile()); |
558 } | 556 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 bottomLeftCornerRadius:kPopupRoundingRadius | 818 bottomLeftCornerRadius:kPopupRoundingRadius |
821 bottomRightCornerRadius:kPopupRoundingRadius]; | 819 bottomRightCornerRadius:kPopupRoundingRadius]; |
822 | 820 |
823 // Draw the matrix clipped to our border. | 821 // Draw the matrix clipped to our border. |
824 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 822 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
825 [path addClip]; | 823 [path addClip]; |
826 [super drawRect:rect]; | 824 [super drawRect:rect]; |
827 } | 825 } |
828 | 826 |
829 @end | 827 @end |
OLD | NEW |