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

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

Issue 10833056: Add a menu to the Action Box Button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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 #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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 field_(field), 92 field_(field),
93 disposition_(CURRENT_TAB), 93 disposition_(CURRENT_TAB),
94 location_icon_decoration_(new LocationIconDecoration(this)), 94 location_icon_decoration_(new LocationIconDecoration(this)),
95 selected_keyword_decoration_( 95 selected_keyword_decoration_(
96 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())), 96 new SelectedKeywordDecoration(OmniboxViewMac::GetFieldFont())),
97 ev_bubble_decoration_( 97 ev_bubble_decoration_(
98 new EVBubbleDecoration(location_icon_decoration_.get(), 98 new EVBubbleDecoration(location_icon_decoration_.get(),
99 OmniboxViewMac::GetFieldFont())), 99 OmniboxViewMac::GetFieldFont())),
100 plus_decoration_(NULL), 100 plus_decoration_(NULL),
101 star_decoration_(new StarDecoration(command_updater)), 101 star_decoration_(new StarDecoration(command_updater)),
102 chrome_to_mobile_decoration_(nil), 102 chrome_to_mobile_decoration_(NULL),
103 keyword_hint_decoration_( 103 keyword_hint_decoration_(
104 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())), 104 new KeywordHintDecoration(OmniboxViewMac::GetFieldFont())),
105 profile_(profile), 105 profile_(profile),
106 browser_(browser), 106 browser_(browser),
107 toolbar_model_(toolbar_model), 107 toolbar_model_(toolbar_model),
108 transition_(content::PageTransitionFromInt( 108 transition_(content::PageTransitionFromInt(
109 content::PAGE_TRANSITION_TYPED | 109 content::PAGE_TRANSITION_TYPED |
110 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), 110 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
111 weak_ptr_factory_(this) { 111 weak_ptr_factory_(this) {
112 // Disable Chrome To Mobile for off-the-record and non-synced profiles, 112 // Disable Chrome To Mobile for off-the-record and non-synced profiles,
113 // or if the feature is disabled by a command line flag or chrome://flags. 113 // or if the feature is disabled by a command line flag or chrome://flags.
114 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() && 114 if (!profile_->IsOffTheRecord() && profile_->IsSyncAccessible() &&
115 ChromeToMobileService::IsChromeToMobileEnabled()) { 115 ChromeToMobileService::IsChromeToMobileEnabled()) {
116 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this); 116 command_updater_->AddCommandObserver(IDC_CHROME_TO_MOBILE_PAGE, this);
117 chrome_to_mobile_decoration_.reset( 117 chrome_to_mobile_decoration_.reset(
118 new ChromeToMobileDecoration(profile, command_updater)); 118 new ChromeToMobileDecoration(profile, command_updater));
119 ChromeToMobileServiceFactory::GetForProfile(profile)-> 119 ChromeToMobileServiceFactory::GetForProfile(profile)->
120 RequestMobileListUpdate(); 120 RequestMobileListUpdate();
121 } 121 }
122 122
123 if (extensions::switch_utils::IsActionBoxEnabled()) { 123 if (extensions::switch_utils::IsActionBoxEnabled()) {
124 plus_decoration_.reset(new PlusDecoration(command_updater)); 124 plus_decoration_.reset(new PlusDecoration(this, command_updater, browser_));
125 } 125 }
126 126
127 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 127 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
128 DCHECK_EQ(i, content_setting_decorations_.size()); 128 DCHECK_EQ(i, content_setting_decorations_.size());
129 ContentSettingsType type = static_cast<ContentSettingsType>(i); 129 ContentSettingsType type = static_cast<ContentSettingsType>(i);
130 content_setting_decorations_.push_back( 130 content_setting_decorations_.push_back(
131 new ContentSettingDecoration(type, this, profile_)); 131 new ContentSettingDecoration(type, this, profile_));
132 } 132 }
133 133
134 registrar_.Add(this, 134 registrar_.Add(this,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 const NSPoint point = star_decoration_->GetBubblePointInFrame(frame); 494 const NSPoint point = star_decoration_->GetBubblePointInFrame(frame);
495 return [field_ convertPoint:point toView:nil]; 495 return [field_ convertPoint:point toView:nil];
496 } 496 }
497 497
498 NSPoint LocationBarViewMac::GetChromeToMobileBubblePoint() const { 498 NSPoint LocationBarViewMac::GetChromeToMobileBubblePoint() const {
499 AutocompleteTextFieldCell* cell = [field_ cell]; 499 AutocompleteTextFieldCell* cell = [field_ cell];
500 const NSRect frame = 500 const NSRect frame =
501 [cell frameForDecoration:chrome_to_mobile_decoration_.get() 501 [cell frameForDecoration:chrome_to_mobile_decoration_.get()
502 inFrame:[field_ bounds]]; 502 inFrame:[field_ bounds]];
503 const NSPoint point = 503 const NSPoint point =
504 chrome_to_mobile_decoration_->GetBubblePointInFrame(frame); 504 chrome_to_mobile_decoration_->GetBubblePointInFrame(frame);
505 return [field_ convertPoint:point toView:nil]; 505 return [field_ convertPoint:point toView:nil];
506 } 506 }
507 507
508 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { 508 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
509 AutocompleteTextFieldCell* cell = [field_ cell]; 509 AutocompleteTextFieldCell* cell = [field_ cell];
510 if (ev_bubble_decoration_->IsVisible()) { 510 if (ev_bubble_decoration_->IsVisible()) {
511 const NSRect frame = [cell frameForDecoration:ev_bubble_decoration_.get() 511 const NSRect frame = [cell frameForDecoration:ev_bubble_decoration_.get()
512 inFrame:[field_ bounds]]; 512 inFrame:[field_ bounds]];
513 const NSPoint point = ev_bubble_decoration_->GetBubblePointInFrame(frame); 513 const NSPoint point = ev_bubble_decoration_->GetBubblePointInFrame(frame);
514 return [field_ convertPoint:point toView:nil]; 514 return [field_ convertPoint:point toView:nil];
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void LocationBarViewMac::UpdateChromeToMobileEnabled() { 727 void LocationBarViewMac::UpdateChromeToMobileEnabled() {
728 if (!chrome_to_mobile_decoration_.get()) 728 if (!chrome_to_mobile_decoration_.get())
729 return; 729 return;
730 730
731 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); 731 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled());
732 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && 732 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() &&
733 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles(); 733 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasMobiles();
734 chrome_to_mobile_decoration_->SetVisible(enabled); 734 chrome_to_mobile_decoration_->SetVisible(enabled);
735 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); 735 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled);
736 } 736 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698