| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 namespace { | 81 namespace { |
| 82 | 82 |
| 83 // Vertical space between the bottom edge of the location_bar and the first run | 83 // Vertical space between the bottom edge of the location_bar and the first run |
| 84 // bubble arrow point. | 84 // bubble arrow point. |
| 85 const static int kFirstRunBubbleYOffset = 1; | 85 const static int kFirstRunBubbleYOffset = 1; |
| 86 | 86 |
| 87 const int kDefaultIconSize = 16; | 87 const int kDefaultIconSize = 16; |
| 88 | 88 |
| 89 // Color of the vector graphic icons when the location bar is dark. | 89 // Color of the vector graphic icons when the location bar is dark. |
| 90 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF); | 90 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF); |
| 91 const SkColor kMaterialDarkVectorIconColor = 0xCCFFFFFF; | 91 const SkColor kMaterialDarkVectorIconColor = SK_ColorWHITE; |
| 92 | 92 |
| 93 } // namespace | 93 } // namespace |
| 94 | 94 |
| 95 // A temporary class that draws hardcoded HTTP graphic icons for Material | 95 // A temporary class that draws hardcoded HTTP graphic icons for Material |
| 96 // design. This class will be removed once the Material icons are available | 96 // design. This class will be removed once the Material icons are available |
| 97 // in M53. | 97 // in M53. |
| 98 @interface LocationBarImageRep : NSCustomImageRep | 98 @interface LocationBarImageRep : NSCustomImageRep |
| 99 @property(assign, nonatomic) gfx::VectorIconId iconId; | 99 @property(assign, nonatomic) gfx::VectorIconId iconId; |
| 100 @property(retain, nonatomic) NSColor* fillColor; | 100 @property(retain, nonatomic) NSColor* fillColor; |
| 101 | 101 |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 : gfx::kGoogleGreen700; | 746 : gfx::kGoogleGreen700; |
| 747 } else { | 747 } else { |
| 748 vector_icon_id = omnibox_view_->GetVectorIcon(in_dark_mode); | 748 vector_icon_id = omnibox_view_->GetVectorIcon(in_dark_mode); |
| 749 if (in_dark_mode) { | 749 if (in_dark_mode) { |
| 750 vector_icon_color = SK_ColorWHITE; | 750 vector_icon_color = SK_ColorWHITE; |
| 751 } else { | 751 } else { |
| 752 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode); | 752 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode); |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 | 755 |
| 756 // If the theme is dark, then the color should always be |
| 757 // kMaterialDarkVectorIconColor. |
| 758 if (in_dark_mode) |
| 759 vector_icon_color = kMaterialDarkVectorIconColor; |
| 760 |
| 756 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE); | 761 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE); |
| 757 NSImage* image = | 762 NSImage* image = |
| 758 [LocationBarImageRep imageForId:vector_icon_id color:vector_icon_color]; | 763 [LocationBarImageRep imageForId:vector_icon_id color:vector_icon_color]; |
| 759 | 764 |
| 760 location_icon_decoration_->SetImage(image); | 765 location_icon_decoration_->SetImage(image); |
| 761 ev_bubble_decoration_->SetImage(image); | 766 ev_bubble_decoration_->SetImage(image); |
| 762 Layout(); | 767 Layout(); |
| 763 } | 768 } |
| 764 | 769 |
| 765 void LocationBarViewMac::UpdateColorsToMatchTheme() { | 770 void LocationBarViewMac::UpdateColorsToMatchTheme() { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 | 988 |
| 984 return zoom_decoration_->UpdateIfNecessary( | 989 return zoom_decoration_->UpdateIfNecessary( |
| 985 ui_zoom::ZoomController::FromWebContents(web_contents), | 990 ui_zoom::ZoomController::FromWebContents(web_contents), |
| 986 default_zoom_changed, IsLocationBarDark()); | 991 default_zoom_changed, IsLocationBarDark()); |
| 987 } | 992 } |
| 988 | 993 |
| 989 void LocationBarViewMac::OnDefaultZoomLevelChanged() { | 994 void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| 990 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) | 995 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| 991 OnDecorationsChanged(); | 996 OnDecorationsChanged(); |
| 992 } | 997 } |
| OLD | NEW |