Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 ++current; | 325 ++current; |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool LocationBarViewMac::GetBookmarkStarVisibility() { | 330 bool LocationBarViewMac::GetBookmarkStarVisibility() { |
| 331 DCHECK(star_decoration_.get()); | 331 DCHECK(star_decoration_.get()); |
| 332 return star_decoration_->IsVisible(); | 332 return star_decoration_->IsVisible(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 bool LocationBarViewMac::TestContentSettingImagePressed(size_t index) { | |
| 336 if (index >= content_setting_decorations_.size()) | |
|
Peter Kasting
2017/02/08 01:00:03
Nit: Should this just DCHECK_LT?
kylix_rd
2017/02/10 22:47:48
I don't think so... since it's called by a test, t
| |
| 337 return false; | |
| 338 | |
| 339 // TODO(tapted): Use OnAccessibilityViewAction() here. Currently it's broken. | |
| 340 ContentSettingDecoration* decoration = | |
| 341 content_setting_decorations_[index].get(); | |
| 342 AutocompleteTextFieldCell* cell = [field_ cell]; | |
| 343 NSRect frame = [cell frameForDecoration:decoration inFrame:[field_ bounds]]; | |
| 344 content_setting_decorations_[index]->OnMousePressed(frame, NSZeroPoint); | |
|
Peter Kasting
2017/02/08 01:00:03
Nit: Can this just use |decoration|?
kylix_rd
2017/02/10 22:47:48
Seems like it should. I just lifted this code from
| |
| 345 return true; | |
| 346 } | |
| 347 | |
| 335 void LocationBarViewMac::SetEditable(bool editable) { | 348 void LocationBarViewMac::SetEditable(bool editable) { |
| 336 [field_ setEditable:editable ? YES : NO]; | 349 [field_ setEditable:editable ? YES : NO]; |
| 337 UpdateBookmarkStarVisibility(); | 350 UpdateBookmarkStarVisibility(); |
| 338 UpdateZoomDecoration(/*default_zoom_changed=*/false); | 351 UpdateZoomDecoration(/*default_zoom_changed=*/false); |
| 339 UpdatePageActions(); | 352 UpdatePageActions(); |
| 340 Layout(); | 353 Layout(); |
| 341 } | 354 } |
| 342 | 355 |
| 343 bool LocationBarViewMac::IsEditable() { | 356 bool LocationBarViewMac::IsEditable() { |
| 344 return [field_ isEditable] ? true : false; | 357 return [field_ isEditable] ? true : false; |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 OnDecorationsChanged(); | 940 OnDecorationsChanged(); |
| 928 } | 941 } |
| 929 | 942 |
| 930 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 943 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 931 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 944 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 932 std::vector<NSView*> views; | 945 std::vector<NSView*> views; |
| 933 for (auto* decoration : decorations) | 946 for (auto* decoration : decorations) |
| 934 views.push_back(decoration->GetAccessibilityView()); | 947 views.push_back(decoration->GetAccessibilityView()); |
| 935 return views; | 948 return views; |
| 936 } | 949 } |
| OLD | NEW |