| 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 bool icons_updated = false; | 644 bool icons_updated = false; |
| 645 for (const auto& decoration : content_setting_decorations_) | 645 for (const auto& decoration : content_setting_decorations_) |
| 646 icons_updated |= decoration->UpdateFromWebContents(web_contents); | 646 icons_updated |= decoration->UpdateFromWebContents(web_contents); |
| 647 return icons_updated; | 647 return icons_updated; |
| 648 } | 648 } |
| 649 | 649 |
| 650 void LocationBarViewMac::ShowFirstRunBubbleInternal() { | 650 void LocationBarViewMac::ShowFirstRunBubbleInternal() { |
| 651 if (!field_ || ![field_ window]) | 651 if (!field_ || ![field_ window]) |
| 652 return; | 652 return; |
| 653 | 653 |
| 654 // The first run bubble's left edge should line up with the left edge of the | 654 // Point the bubble's arrow at the middle of the bottom of the page info icon. |
| 655 // omnibox. This is different from other bubbles, which line up at a point | 655 const NSPoint kOffset = |
| 656 // set by their top arrow. Because the BaseBubbleController adjusts the | 656 NSMakePoint(info_bubble::kBubbleArrowXOffset, kFirstRunBubbleYOffset); |
| 657 // window origin left to account for the arrow spacing, the first run bubble | |
| 658 // moves the window origin right by this spacing, so that the | |
| 659 // BaseBubbleController will move it back to the correct position. | |
| 660 const NSPoint kOffset = NSMakePoint( | |
| 661 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, | |
| 662 kFirstRunBubbleYOffset); | |
| 663 [FirstRunBubbleController showForView:field_ | 657 [FirstRunBubbleController showForView:field_ |
| 664 offset:kOffset | 658 offset:kOffset |
| 665 browser:browser_ | 659 browser:browser_ |
| 666 profile:profile()]; | 660 profile:profile()]; |
| 667 } | 661 } |
| 668 | 662 |
| 669 void LocationBarViewMac::UpdateTranslateDecoration() { | 663 void LocationBarViewMac::UpdateTranslateDecoration() { |
| 670 if (!TranslateService::IsTranslateBubbleEnabled()) | 664 if (!TranslateService::IsTranslateBubbleEnabled()) |
| 671 return; | 665 return; |
| 672 | 666 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 OnDecorationsChanged(); | 799 OnDecorationsChanged(); |
| 806 } | 800 } |
| 807 | 801 |
| 808 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 802 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 809 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 803 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 810 std::vector<NSView*> views; | 804 std::vector<NSView*> views; |
| 811 for (auto* decoration : decorations) | 805 for (auto* decoration : decorations) |
| 812 views.push_back(decoration->GetAccessibilityView()); | 806 views.push_back(decoration->GetAccessibilityView()); |
| 813 return views; | 807 return views; |
| 814 } | 808 } |
| OLD | NEW |