diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 16:08:28 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 16:08:28 +0000 |
commit | 7ca5cde25380c8dc47b5ac322e2893df875a4643 (patch) | |
tree | 88eca4a04e6ed0dd2797a7b6f0c47ed734b65cd7 /chrome/browser/cocoa | |
parent | 59b29bdb4dd598cf71d2fedcaa0014c4047f4030 (diff) | |
download | chromium_src-7ca5cde25380c8dc47b5ac322e2893df875a4643.zip chromium_src-7ca5cde25380c8dc47b5ac322e2893df875a4643.tar.gz chromium_src-7ca5cde25380c8dc47b5ac322e2893df875a4643.tar.bz2 |
[Mac] No star icon or page actions in omnibox on popups.
BUG=40730
TEST=install "lights out" extension. Go to www.popuptest.com. See if the page-action and the star are still in a popup.
Review URL: http://codereview.chromium.org/1627012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/location_bar_view_mac.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/location_bar_view_mac.mm | 15 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h index ebff104..ac55c21 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.h +++ b/chrome/browser/cocoa/location_bar_view_mac.h @@ -76,6 +76,10 @@ class LocationBarViewMac : public AutocompleteEditController, virtual ExtensionAction* GetVisiblePageAction(size_t index); virtual void TestPageActionPressed(size_t index); + // Set/Get the editable state of the field. + void SetEditable(bool editable); + bool IsEditable(); + // Set the starred state of the bookmark star. void SetStarred(bool starred); diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm index 6a7afba..721fc7a 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar_view_mac.mm @@ -453,6 +453,16 @@ void LocationBarViewMac::TestPageActionPressed(size_t index) { page_action_views_.OnMousePressed(NSZeroRect, index); } +void LocationBarViewMac::SetEditable(bool editable) { + [field_ setEditable:editable ? YES : NO]; + star_icon_view_.SetVisible(editable); + UpdatePageActions(); +} + +bool LocationBarViewMac::IsEditable() { + return [field_ isEditable] ? true : false; +} + void LocationBarViewMac::SetStarred(bool starred) { star_icon_view_.SetStarred(starred); [field_ updateCursorAndToolTipRects]; @@ -945,6 +955,11 @@ void LocationBarViewMac::PageActionViewList::DeleteAll() { } void LocationBarViewMac::PageActionViewList::RefreshViews() { + if (!owner_->IsEditable()) { + DeleteAll(); + return; + } + std::vector<ExtensionAction*> page_actions; ExtensionsService* service = profile_->GetExtensionsService(); if (!service) diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index f93ac61..a05c0e4 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -442,7 +442,7 @@ class PrefObserverBridge : public NotificationObserver { // Make location bar not editable when in a pop-up. // TODO(viettrungluu): is this right (all the time)? - [locationBar_ setEditable:toolbar]; + locationBarView_->SetEditable(toolbar ? true : false); } - (NSView*)view { |