| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "ui/gfx/color_utils.h" | 70 #include "ui/gfx/color_utils.h" |
| 71 #include "ui/gfx/image/image.h" | 71 #include "ui/gfx/image/image.h" |
| 72 #include "ui/gfx/image/image_skia_util_mac.h" | 72 #include "ui/gfx/image/image_skia_util_mac.h" |
| 73 #include "ui/gfx/paint_vector_icon.h" | 73 #include "ui/gfx/paint_vector_icon.h" |
| 74 #include "ui/vector_icons/vector_icons.h" | 74 #include "ui/vector_icons/vector_icons.h" |
| 75 | 75 |
| 76 using content::WebContents; | 76 using content::WebContents; |
| 77 | 77 |
| 78 namespace { | 78 namespace { |
| 79 | 79 |
| 80 // Vertical space between the bottom edge of the location_bar and the first run | |
| 81 // bubble arrow point. | |
| 82 const static int kFirstRunBubbleYOffset = 1; | |
| 83 | |
| 84 const int kDefaultIconSize = 16; | 80 const int kDefaultIconSize = 16; |
| 85 | 81 |
| 86 // The minimum width the URL should have for the verbose state to be shown. | 82 // The minimum width the URL should have for the verbose state to be shown. |
| 87 const int kMinURLWidth = 120; | 83 const int kMinURLWidth = 120; |
| 88 | 84 |
| 89 // Color of the vector graphic icons when the location bar is dark. | 85 // Color of the vector graphic icons when the location bar is dark. |
| 90 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF); | 86 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF); |
| 91 const SkColor kMaterialDarkVectorIconColor = SK_ColorWHITE; | 87 const SkColor kMaterialDarkVectorIconColor = SK_ColorWHITE; |
| 92 | 88 |
| 93 } // namespace | 89 } // namespace |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 bool icons_updated = false; | 645 bool icons_updated = false; |
| 650 for (const auto& decoration : content_setting_decorations_) | 646 for (const auto& decoration : content_setting_decorations_) |
| 651 icons_updated |= decoration->UpdateFromWebContents(web_contents); | 647 icons_updated |= decoration->UpdateFromWebContents(web_contents); |
| 652 return icons_updated; | 648 return icons_updated; |
| 653 } | 649 } |
| 654 | 650 |
| 655 void LocationBarViewMac::ShowFirstRunBubbleInternal() { | 651 void LocationBarViewMac::ShowFirstRunBubbleInternal() { |
| 656 if (!field_ || ![field_ window]) | 652 if (!field_ || ![field_ window]) |
| 657 return; | 653 return; |
| 658 | 654 |
| 659 // Point the bubble's arrow at the middle of the bottom of the page info icon. | 655 // Point the bubble's arrow at the middle of the page info icon. The x offset |
| 660 const NSPoint kOffset = | 656 // isn't the exact center, but this behavior matches other platforms and it |
| 661 NSMakePoint(info_bubble::kBubbleArrowXOffset, kFirstRunBubbleYOffset); | 657 // looks better in practice since the arrow ends up between the handle and |
| 658 // lens of the magnifying glass. |
| 659 const NSPoint kOffset = NSMakePoint( |
| 660 info_bubble::kBubbleArrowXOffset, |
| 661 NSHeight([field_ frame]) / 2.0 - info_bubble::kBubbleArrowHeight); |
| 662 [FirstRunBubbleController showForView:field_ | 662 [FirstRunBubbleController showForView:field_ |
| 663 offset:kOffset | 663 offset:kOffset |
| 664 browser:browser_ | 664 browser:browser_ |
| 665 profile:profile()]; | 665 profile:profile()]; |
| 666 } | 666 } |
| 667 | 667 |
| 668 void LocationBarViewMac::UpdateTranslateDecoration() { | 668 void LocationBarViewMac::UpdateTranslateDecoration() { |
| 669 if (!TranslateService::IsTranslateBubbleEnabled()) | 669 if (!TranslateService::IsTranslateBubbleEnabled()) |
| 670 return; | 670 return; |
| 671 | 671 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 OnDecorationsChanged(); | 804 OnDecorationsChanged(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 807 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 808 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 808 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 809 std::vector<NSView*> views; | 809 std::vector<NSView*> views; |
| 810 for (auto* decoration : decorations) | 810 for (auto* decoration : decorations) |
| 811 views.push_back(decoration->GetAccessibilityView()); | 811 views.push_back(decoration->GetAccessibilityView()); |
| 812 return views; | 812 return views; |
| 813 } | 813 } |
| OLD | NEW |