| OLD | NEW |
| 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/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 [forwardButton_ setHandleMiddleClick:YES]; | 443 [forwardButton_ setHandleMiddleClick:YES]; |
| 444 [reloadButton_ setHandleMiddleClick:YES]; | 444 [reloadButton_ setHandleMiddleClick:YES]; |
| 445 [homeButton_ setHandleMiddleClick:YES]; | 445 [homeButton_ setHandleMiddleClick:YES]; |
| 446 | 446 |
| 447 [self initCommandStatus:commands_]; | 447 [self initCommandStatus:commands_]; |
| 448 [reloadButton_ setCommandUpdater:commands_]; | 448 [reloadButton_ setCommandUpdater:commands_]; |
| 449 | 449 |
| 450 locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_, | 450 locationBarView_.reset(new LocationBarViewMac(locationBar_, commands_, |
| 451 profile_, browser_)); | 451 profile_, browser_)); |
| 452 [locationBar_ setFont:[NSFont systemFontOfSize:14]]; | 452 [locationBar_ setFont:[NSFont systemFontOfSize:14]]; |
| 453 |
| 454 // Add the location bar's accessibility views as direct subviews of the |
| 455 // toolbar. They are logical children of the location bar, but the location |
| 456 // bar's actual Cocoa control is an NSCell, so it cannot have child views. |
| 457 // The |locationBarView_| is responsible for positioning the accessibility |
| 458 // views. |
| 459 std::vector<NSView*> accessibility_views = |
| 460 locationBarView_->GetDecorationAccessibilityViews(); |
| 461 for (const auto& view : accessibility_views) { |
| 462 [[self toolbarView] addSubview:view |
| 463 positioned:NSWindowAbove |
| 464 relativeTo:locationBar_]; |
| 465 } |
| 466 |
| 453 if (!isModeMaterial) { | 467 if (!isModeMaterial) { |
| 454 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 468 [locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
| 455 } | 469 } |
| 456 | 470 |
| 457 // Register pref observers for the optional home and page/options buttons | 471 // Register pref observers for the optional home and page/options buttons |
| 458 // and then add them to the toolbar based on those prefs. | 472 // and then add them to the toolbar based on those prefs. |
| 459 PrefService* prefs = profile_->GetPrefs(); | 473 PrefService* prefs = profile_->GetPrefs(); |
| 460 showHomeButton_.Init( | 474 showHomeButton_.Init( |
| 461 prefs::kShowHomeButton, prefs, | 475 prefs::kShowHomeButton, prefs, |
| 462 base::Bind( | 476 base::Bind( |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 1169 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 1156 // Do nothing. | 1170 // Do nothing. |
| 1157 } | 1171 } |
| 1158 | 1172 |
| 1159 // (URLDropTargetController protocol) | 1173 // (URLDropTargetController protocol) |
| 1160 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { | 1174 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { |
| 1161 return drag_util::IsUnsupportedDropData(profile_, info); | 1175 return drag_util::IsUnsupportedDropData(profile_, info); |
| 1162 } | 1176 } |
| 1163 | 1177 |
| 1164 @end | 1178 @end |
| OLD | NEW |