| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return [[field_ window] inIncognitoModeWithSystemTheme]; | 581 return [[field_ window] inIncognitoModeWithSystemTheme]; |
| 582 } | 582 } |
| 583 | 583 |
| 584 LocationBarDecoration* LocationBarViewMac::GetPageInfoDecoration() const { | 584 LocationBarDecoration* LocationBarViewMac::GetPageInfoDecoration() const { |
| 585 if (security_state_bubble_decoration_->IsVisible()) | 585 if (security_state_bubble_decoration_->IsVisible()) |
| 586 return security_state_bubble_decoration_.get(); | 586 return security_state_bubble_decoration_.get(); |
| 587 | 587 |
| 588 return location_icon_decoration_.get(); | 588 return location_icon_decoration_.get(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 LocationBarDecoration* LocationBarViewMac::GetContentSettingDecoration( |
| 592 NSPoint anchor) const { |
| 593 NSPoint anchorInView = |
| 594 ui::ConvertPointFromScreenToWindow([field_ window], anchor); |
| 595 for (const auto& decoration : content_setting_decorations_) { |
| 596 if (decoration->IsVisible() && |
| 597 NSEqualPoints([field_ arrowAnchorPointForDecoration:decoration.get()], |
| 598 anchorInView)) { |
| 599 return decoration.get(); |
| 600 } |
| 601 } |
| 602 |
| 603 return nullptr; |
| 604 } |
| 605 |
| 591 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) { | 606 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) { |
| 592 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( | 607 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( |
| 593 profile())->GetTemplateURLForKeyword(keyword); | 608 profile())->GetTemplateURLForKeyword(keyword); |
| 594 if (template_url && | 609 if (template_url && |
| 595 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 610 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
| 596 return extensions::OmniboxAPI::Get(profile())-> | 611 return extensions::OmniboxAPI::Get(profile())-> |
| 597 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); | 612 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); |
| 598 } | 613 } |
| 599 | 614 |
| 600 SkColor icon_color = | 615 SkColor icon_color = |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 OnDecorationsChanged(); | 820 OnDecorationsChanged(); |
| 806 } | 821 } |
| 807 | 822 |
| 808 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 823 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
| 809 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 824 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
| 810 std::vector<NSView*> views; | 825 std::vector<NSView*> views; |
| 811 for (auto* decoration : decorations) | 826 for (auto* decoration : decorations) |
| 812 views.push_back(decoration->GetAccessibilityView()); | 827 views.push_back(decoration->GetAccessibilityView()); |
| 813 return views; | 828 return views; |
| 814 } | 829 } |
| OLD | NEW |