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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 12286006: [Mac] Implement the basic zoom bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Auto-close bubble Created 7 years, 10 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 location_icon_decoration_(new LocationIconDecoration(this)), 96 location_icon_decoration_(new LocationIconDecoration(this)),
97 search_token_decoration_(new SearchTokenDecoration()), 97 search_token_decoration_(new SearchTokenDecoration()),
98 selected_keyword_decoration_( 98 selected_keyword_decoration_(
99 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())), 99 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())),
100 separator_decoration_(new SeparatorDecoration()), 100 separator_decoration_(new SeparatorDecoration()),
101 ev_bubble_decoration_( 101 ev_bubble_decoration_(
102 new EVBubbleDecoration(location_icon_decoration_.get(), 102 new EVBubbleDecoration(location_icon_decoration_.get(),
103 OmniboxViewMac::GetFieldFont())), 103 OmniboxViewMac::GetFieldFont())),
104 plus_decoration_(NULL), 104 plus_decoration_(NULL),
105 star_decoration_(new StarDecoration(command_updater)), 105 star_decoration_(new StarDecoration(command_updater)),
106 zoom_decoration_(new ZoomDecoration(toolbar_model)), 106 zoom_decoration_(new ZoomDecoration(this)),
107 keyword_hint_decoration_( 107 keyword_hint_decoration_(
108 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), 108 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())),
109 profile_(profile), 109 profile_(profile),
110 browser_(browser), 110 browser_(browser),
111 toolbar_model_(toolbar_model), 111 toolbar_model_(toolbar_model),
112 transition_(content::PageTransitionFromInt( 112 transition_(content::PageTransitionFromInt(
113 content::PAGE_TRANSITION_TYPED | 113 content::PAGE_TRANSITION_TYPED |
114 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), 114 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
115 weak_ptr_factory_(this) { 115 weak_ptr_factory_(this) {
116 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { 116 if (extensions::FeatureSwitch::action_box()->IsEnabled()) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 void LocationBarViewMac::SetActionBoxIcon(int image_id) { 509 void LocationBarViewMac::SetActionBoxIcon(int image_id) {
510 plus_decoration_->SetTemporaryIcon(image_id); 510 plus_decoration_->SetTemporaryIcon(image_id);
511 OnDecorationsChanged(); 511 OnDecorationsChanged();
512 } 512 }
513 513
514 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { 514 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) {
515 UpdateZoomDecoration(); 515 UpdateZoomDecoration();
516 OnDecorationsChanged(); 516 OnDecorationsChanged();
517 517
518 // TODO(dbeam): show a zoom bubble when |can_show_bubble| is true, the zoom 518 if (can_show_bubble && zoom_decoration_->IsVisible())
519 // decoration is showing, and the wrench menu isn't showing. 519 zoom_decoration_->ShowBubble(YES);
520 } 520 }
521 521
522 NSPoint LocationBarViewMac::GetActionBoxAnchorPoint() const { 522 NSPoint LocationBarViewMac::GetActionBoxAnchorPoint() const {
523 return plus_decoration_->GetActionBoxAnchorPoint(); 523 return plus_decoration_->GetActionBoxAnchorPoint();
524 } 524 }
525 525
526 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { 526 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const {
527 AutocompleteTextFieldCell* cell = [field_ cell]; 527 AutocompleteTextFieldCell* cell = [field_ cell];
528 const NSRect frame = [cell frameForDecoration:star_decoration_.get() 528 const NSRect frame = [cell frameForDecoration:star_decoration_.get()
529 inFrame:[field_ bounds]]; 529 inFrame:[field_ bounds]];
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // TODO(shess): Shortly, this code will live somewhere else, like in 660 // TODO(shess): Shortly, this code will live somewhere else, like in
661 // the constructor. I am still wrestling with how best to deal with 661 // the constructor. I am still wrestling with how best to deal with
662 // right-hand decorations, which are not a static set. 662 // right-hand decorations, which are not a static set.
663 [cell clearDecorations]; 663 [cell clearDecorations];
664 [cell addLeftDecoration:location_icon_decoration_.get()]; 664 [cell addLeftDecoration:location_icon_decoration_.get()];
665 [cell addLeftDecoration:selected_keyword_decoration_.get()]; 665 [cell addLeftDecoration:selected_keyword_decoration_.get()];
666 [cell addLeftDecoration:ev_bubble_decoration_.get()]; 666 [cell addLeftDecoration:ev_bubble_decoration_.get()];
667 if (plus_decoration_.get()) 667 if (plus_decoration_.get())
668 [cell addRightDecoration:plus_decoration_.get()]; 668 [cell addRightDecoration:plus_decoration_.get()];
669 [cell addRightDecoration:star_decoration_.get()]; 669 [cell addRightDecoration:star_decoration_.get()];
670 // TODO(dbeam): uncomment when zoom bubble exists. 670 [cell addRightDecoration:zoom_decoration_.get()];
671 // [cell addRightDecoration:zoom_decoration_.get()];
672 671
673 // Note that display order is right to left. 672 // Note that display order is right to left.
674 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { 673 for (size_t i = 0; i < page_action_decorations_.size(); ++i) {
675 [cell addRightDecoration:page_action_decorations_[i]]; 674 [cell addRightDecoration:page_action_decorations_[i]];
676 } 675 }
677 for (size_t i = 0; i < content_setting_decorations_.size(); ++i) { 676 for (size_t i = 0; i < content_setting_decorations_.size(); ++i) {
678 [cell addRightDecoration:content_setting_decorations_[i]]; 677 [cell addRightDecoration:content_setting_decorations_[i]];
679 } 678 }
680 679
681 [cell addRightDecoration:keyword_hint_decoration_.get()]; 680 [cell addRightDecoration:keyword_hint_decoration_.get()];
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 if (!toolbar_model_->GetInputInProgress() && 782 if (!toolbar_model_->GetInputInProgress() &&
784 toolbar_model_->WouldReplaceSearchURLWithSearchTerms()) { 783 toolbar_model_->WouldReplaceSearchURLWithSearchTerms()) {
785 const TemplateURL* template_url = 784 const TemplateURL* template_url =
786 TemplateURLServiceFactory::GetForProfile(profile_)-> 785 TemplateURLServiceFactory::GetForProfile(profile_)->
787 GetDefaultSearchProvider(); 786 GetDefaultSearchProvider();
788 if (template_url) 787 if (template_url)
789 return template_url->short_name(); 788 return template_url->short_name();
790 } 789 }
791 return string16(); 790 return string16();
792 } 791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698