| 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 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) { | 814 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) { |
| 815 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( | 815 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( |
| 816 profile())->GetTemplateURLForKeyword(keyword); | 816 profile())->GetTemplateURLForKeyword(keyword); |
| 817 if (template_url && | 817 if (template_url && |
| 818 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 818 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
| 819 return extensions::OmniboxAPI::Get(profile())-> | 819 return extensions::OmniboxAPI::Get(profile())-> |
| 820 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); | 820 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); |
| 821 } | 821 } |
| 822 | 822 |
| 823 return ui::MaterialDesignController::IsModeMaterial() | 823 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 824 ? NSImageFromImageSkiaWithColorSpace( | 824 SkColor icon_color = IsLocationBarDark() ? kMaterialDarkVectorIconColor |
| 825 gfx::CreateVectorIcon( | 825 : gfx::kGoogleBlue700; |
| 826 gfx::VectorIconId::OMNIBOX_SEARCH, | 826 return NSImageFromImageSkiaWithColorSpace( |
| 827 kDefaultIconSize, | 827 gfx::CreateVectorIcon(gfx::VectorIconId::OMNIBOX_SEARCH, |
| 828 gfx::kGoogleBlue700), | 828 kDefaultIconSize, icon_color), |
| 829 base::mac::GetSRGBColorSpace()) | 829 base::mac::GetSRGBColorSpace()); |
| 830 : OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); | 830 } |
| 831 |
| 832 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); |
| 831 } | 833 } |
| 832 | 834 |
| 833 void LocationBarViewMac::PostNotification(NSString* notification) { | 835 void LocationBarViewMac::PostNotification(NSString* notification) { |
| 834 [[NSNotificationCenter defaultCenter] postNotificationName:notification | 836 [[NSNotificationCenter defaultCenter] postNotificationName:notification |
| 835 object:[NSValue valueWithPointer:this]]; | 837 object:[NSValue valueWithPointer:this]]; |
| 836 } | 838 } |
| 837 | 839 |
| 838 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( | 840 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( |
| 839 ExtensionAction* page_action) { | 841 ExtensionAction* page_action) { |
| 840 DCHECK(page_action); | 842 DCHECK(page_action); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 | 963 |
| 962 return zoom_decoration_->UpdateIfNecessary( | 964 return zoom_decoration_->UpdateIfNecessary( |
| 963 ui_zoom::ZoomController::FromWebContents(web_contents), | 965 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 964 default_zoom_changed, IsLocationBarDark()); | 966 default_zoom_changed, IsLocationBarDark()); |
| 965 } | 967 } |
| 966 | 968 |
| 967 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 969 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 968 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 970 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 969 OnDecorationsChanged(); | 971 OnDecorationsChanged(); |
| 970 } | 972 } |
| OLD | NEW |