summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_unittest.mm8
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.h3
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.mm14
3 files changed, 18 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
index f82fca7..b6f044f 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_unittest.mm
@@ -27,9 +27,11 @@ class MockLocationIconView : public LocationBarViewMac::LocationIconView {
MockLocationIconView(LocationBarViewMac* owner)
: LocationBarViewMac::LocationIconView(owner) {}
- // |LocationBarViewMac::LocationIconView::GetDragPasteboard()|
- // expects things to be more initialized than they will be, and
- // will crash if it is called.
+ // |LocationBarViewMac::LocationIconView| dragging support needs
+ // more setup than this test provides.
+ bool IsDraggable() {
+ return false;
+ }
virtual NSPasteboard* GetDragPasteboard() {
return [NSPasteboard pasteboardWithUniqueName];
}
diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h
index 7eee821..ebff104 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.h
+++ b/chrome/browser/cocoa/location_bar_view_mac.h
@@ -61,6 +61,9 @@ class LocationBarViewMac : public AutocompleteEditController,
virtual void InvalidatePageActions();
virtual void SaveStateToContents(TabContents* contents);
virtual void Revert();
+ virtual const AutocompleteEditView* location_entry() const {
+ return edit_view_.get();
+ }
virtual AutocompleteEditView* location_entry() {
return edit_view_.get();
}
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index c2c10dd..6a7afba 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -601,8 +601,11 @@ LocationBarViewMac::LocationIconView::LocationIconView(
LocationBarViewMac::LocationIconView::~LocationIconView() {}
void LocationBarViewMac::LocationIconView::OnMousePressed(NSRect bounds) {
- // TODO(shess): Only allow click if page-info makes sense.
- // http://codereview.chromium.org/1594012
+ // Do not show page info if the user has been editing the location
+ // bar, or the location bar is at the NTP.
+ if (owner_->location_entry()->IsEditingOrEmpty())
+ return;
+
TabContents* tab = owner_->GetTabContents();
NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
if (!nav_entry) {
@@ -613,8 +616,11 @@ void LocationBarViewMac::LocationIconView::OnMousePressed(NSRect bounds) {
}
bool LocationBarViewMac::LocationIconView::IsDraggable() {
- // TODO(shess): Only allow drag if there's an URL to drag.
- // http://codereview.chromium.org/1594012
+ // Do not drag if the user has been editing the location bar, or the
+ // location bar is at the NTP.
+ if (owner_->location_entry()->IsEditingOrEmpty())
+ return false;
+
return true;
}