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 int LocationBarViewMac::ContentSettingImageModelCount() { | |
| 336 return content_setting_decorations_.size(); | |
| 337 } | |
| 338 | |
| 339 ContentSettingImageModel* LocationBarViewMac::GetContentSettingImageModel( | |
| 340 size_t index) { | |
| 341 DCHECK(index >= 0 && index < content_setting_decorations_.size()); | |
|
tapted
2017/02/03 00:35:39
optional: remove - .at(..) will throw an exception
kylix_rd
2017/02/03 18:55:03
Are exceptions OK in the Mac world?
Peter Kasting
2017/02/03 22:20:41
For reference, in .cc files I ask people to avoid
tapted
2017/02/03 23:07:02
I think the C++ library is pre-built with exceptio
tapted
2017/02/03 23:07:02
Ooh nice! I'm glad we clarify this.
go/cppguide a
| |
| 342 return content_setting_decorations_.at(index)->content_setting_image_model(); | |
| 343 } | |
| 344 | |
| 335 void LocationBarViewMac::SetEditable(bool editable) { | 345 void LocationBarViewMac::SetEditable(bool editable) { |
| 336 [field_ setEditable:editable ? YES : NO]; | 346 [field_ setEditable:editable ? YES : NO]; |
| 337 UpdateBookmarkStarVisibility(); | 347 UpdateBookmarkStarVisibility(); |
| 338 UpdateZoomDecoration(/*default_zoom_changed=*/false); | 348 UpdateZoomDecoration(/*default_zoom_changed=*/false); |
| 339 UpdatePageActions(); | 349 UpdatePageActions(); |
| 340 Layout(); | 350 Layout(); |
| 341 } | 351 } |
| 342 | 352 |
| 343 bool LocationBarViewMac::IsEditable() { | 353 bool LocationBarViewMac::IsEditable() { |
| 344 return [field_ isEditable] ? true : false; | 354 return [field_ isEditable] ? true : false; |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 OnDecorationsChanged(); | 955 OnDecorationsChanged(); |
| 946 } | 956 } |
| 947 | 957 |
| 948 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 958 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 949 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 959 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 950 std::vector<NSView*> views; | 960 std::vector<NSView*> views; |
| 951 for (auto* decoration : decorations) | 961 for (auto* decoration : decorations) |
| 952 views.push_back(decoration->GetAccessibilityView()); | 962 views.push_back(decoration->GetAccessibilityView()); |
| 953 return views; | 963 return views; |
| 954 } | 964 } |
| OLD | NEW |