Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm

Issue 7574021: Remove frontend code that allows for dynamic profile setting, and read the profile off the browse... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // Return the currently highlighted row. Returns -1 if no row is 277 // Return the currently highlighted row. Returns -1 if no row is
278 // highlighted. 278 // highlighted.
279 - (NSInteger)highlightedRow; 279 - (NSInteger)highlightedRow;
280 280
281 @end 281 @end
282 282
283 OmniboxPopupViewMac::OmniboxPopupViewMac(OmniboxViewMac* omnibox_view, 283 OmniboxPopupViewMac::OmniboxPopupViewMac(OmniboxViewMac* omnibox_view,
284 AutocompleteEditModel* edit_model, 284 AutocompleteEditModel* edit_model,
285 Profile* profile, 285 Profile* profile,
286 NSTextField* field) 286 NSTextField* field)
287 : model_(new AutocompletePopupModel(this, edit_model, profile)), 287 : omnibox_view_(omnibox_view),
288 omnibox_view_(omnibox_view), 288 model_(new AutocompletePopupModel(this, edit_model)),
289 profile_(profile),
289 field_(field), 290 field_(field),
290 popup_(nil), 291 popup_(nil),
291 opt_in_controller_(nil), 292 opt_in_controller_(nil),
292 targetPopupFrame_(NSZeroRect) { 293 targetPopupFrame_(NSZeroRect) {
293 DCHECK(omnibox_view); 294 DCHECK(omnibox_view);
294 DCHECK(edit_model); 295 DCHECK(edit_model);
295 DCHECK(profile); 296 DCHECK(profile);
296 } 297 }
297 298
298 OmniboxPopupViewMac::~OmniboxPopupViewMac() { 299 OmniboxPopupViewMac::~OmniboxPopupViewMac() {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // relevant match out to make sure it stays alive until the call 543 // relevant match out to make sure it stays alive until the call
543 // completes. 544 // completes.
544 AutocompleteMatch match = model_->result().match_at(row); 545 AutocompleteMatch match = model_->result().match_at(row);
545 string16 keyword; 546 string16 keyword;
546 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); 547 const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
547 omnibox_view_->OpenMatch(match, disposition, GURL(), row, 548 omnibox_view_->OpenMatch(match, disposition, GURL(), row,
548 is_keyword_hint ? string16() : keyword); 549 is_keyword_hint ? string16() : keyword);
549 } 550 }
550 551
551 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) { 552 void OmniboxPopupViewMac::UserPressedOptIn(bool opt_in) {
552 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); 553 PromoCounter* counter = profile_->GetInstantPromoCounter();
553 DCHECK(counter); 554 DCHECK(counter);
554 counter->Hide(); 555 counter->Hide();
555 if (opt_in) { 556 if (opt_in) {
556 browser::ShowInstantConfirmDialogIfNecessary([field_ window], 557 browser::ShowInstantConfirmDialogIfNecessary([field_ window], profile_);
557 model_->profile());
558 } 558 }
559 559
560 // This call will remove and delete |opt_in_controller_|. 560 // This call will remove and delete |opt_in_controller_|.
561 UpdatePopupAppearance(); 561 UpdatePopupAppearance();
562 } 562 }
563 563
564 bool OmniboxPopupViewMac::ShouldShowInstantOptIn() { 564 bool OmniboxPopupViewMac::ShouldShowInstantOptIn() {
565 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); 565 PromoCounter* counter = profile_->GetInstantPromoCounter();
566 return (counter && counter->ShouldShow(base::Time::Now())); 566 return (counter && counter->ShouldShow(base::Time::Now()));
567 } 567 }
568 568
569 @implementation AutocompleteButtonCell 569 @implementation AutocompleteButtonCell
570 570
571 - (id)init { 571 - (id)init {
572 self = [super init]; 572 self = [super init];
573 if (self) { 573 if (self) {
574 [self setImagePosition:NSImageLeft]; 574 [self setImagePosition:NSImageLeft];
575 [self setBordered:NO]; 575 [self setBordered:NO];
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 bottomLeftCornerRadius:kPopupRoundingRadius 820 bottomLeftCornerRadius:kPopupRoundingRadius
821 bottomRightCornerRadius:kPopupRoundingRadius]; 821 bottomRightCornerRadius:kPopupRoundingRadius];
822 822
823 // Draw the matrix clipped to our border. 823 // Draw the matrix clipped to our border.
824 gfx::ScopedNSGraphicsContextSaveGState scopedGState; 824 gfx::ScopedNSGraphicsContextSaveGState scopedGState;
825 [path addClip]; 825 [path addClip];
826 [super drawRect:rect]; 826 [super drawRect:rect];
827 } 827 }
828 828
829 @end 829 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h ('k') | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698