Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 1990703002: [Material][Mac] Update Omnibox bubble decorations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix incognito dark color in keyword Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 using content::WebContents; 79 using content::WebContents;
80 80
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 const int kMaterialSmallIconSize = 12; 88
89 // Color of the vector graphic icons when the location bar is dark.
90 // SkColorSetARGB(0xCC, 0xFF, 0xFF 0xFF);
91 const SkColor kMaterialDarkVectorIconColor = 0xCCFFFFFF;
89 92
90 } // namespace 93 } // namespace
91 94
92 // TODO(shess): This code is mostly copied from the gtk 95 // TODO(shess): This code is mostly copied from the gtk
93 // implementation. Make sure it's all appropriate and flesh it out. 96 // implementation. Make sure it's all appropriate and flesh it out.
94 97
95 LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field, 98 LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field,
96 CommandUpdater* command_updater, 99 CommandUpdater* command_updater,
97 Profile* profile, 100 Profile* profile,
98 Browser* browser) 101 Browser* browser)
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 563 }
561 564
562 void LocationBarViewMac::UpdateLocationIcon() { 565 void LocationBarViewMac::UpdateLocationIcon() {
563 bool in_dark_mode = IsLocationBarDark(); 566 bool in_dark_mode = IsLocationBarDark();
564 567
565 SkColor vector_icon_color = gfx::kPlaceholderColor; 568 SkColor vector_icon_color = gfx::kPlaceholderColor;
566 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; 569 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
567 int icon_size = kDefaultIconSize; 570 int icon_size = kDefaultIconSize;
568 if (ShouldShowEVBubble()) { 571 if (ShouldShowEVBubble()) {
569 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP; 572 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
570 vector_icon_color = gfx::kGoogleGreen700; 573 vector_icon_color =
571 icon_size = kMaterialSmallIconSize; 574 in_dark_mode ? kMaterialDarkVectorIconColor : gfx::kGoogleGreen700;
572 } else { 575 } else {
573 vector_icon_id = omnibox_view_->GetVectorIcon(in_dark_mode); 576 vector_icon_id = omnibox_view_->GetVectorIcon(in_dark_mode);
574 if (in_dark_mode) { 577 if (in_dark_mode) {
575 vector_icon_color = SK_ColorWHITE; 578 vector_icon_color = SK_ColorWHITE;
576 } else { 579 } else {
577 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode); 580 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode);
578 } 581 }
579 } 582 }
580 583
581 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE); 584 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 662
660 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) { 663 NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) {
661 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile( 664 const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile(
662 profile())->GetTemplateURLForKeyword(keyword); 665 profile())->GetTemplateURLForKeyword(keyword);
663 if (template_url && 666 if (template_url &&
664 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { 667 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) {
665 return extensions::OmniboxAPI::Get(profile())-> 668 return extensions::OmniboxAPI::Get(profile())->
666 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); 669 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage();
667 } 670 }
668 671
669 return ui::MaterialDesignController::IsModeMaterial() 672 if (ui::MaterialDesignController::IsModeMaterial()) {
670 ? NSImageFromImageSkiaWithColorSpace( 673 SkColor icon_color = IsLocationBarDark() ? kMaterialDarkVectorIconColor
671 gfx::CreateVectorIcon( 674 : gfx::kGoogleBlue700;
672 gfx::VectorIconId::OMNIBOX_SEARCH, 675 return NSImageFromImageSkiaWithColorSpace(
673 kDefaultIconSize, 676 gfx::CreateVectorIcon(gfx::VectorIconId::OMNIBOX_SEARCH,
674 gfx::kGoogleBlue700), 677 kDefaultIconSize, icon_color),
675 base::mac::GetSRGBColorSpace()) 678 base::mac::GetSRGBColorSpace());
676 : OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); 679 }
680
681 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH);
677 } 682 }
678 683
679 void LocationBarViewMac::PostNotification(NSString* notification) { 684 void LocationBarViewMac::PostNotification(NSString* notification) {
680 [[NSNotificationCenter defaultCenter] postNotificationName:notification 685 [[NSNotificationCenter defaultCenter] postNotificationName:notification
681 object:[NSValue valueWithPointer:this]]; 686 object:[NSValue valueWithPointer:this]];
682 } 687 }
683 688
684 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration( 689 PageActionDecoration* LocationBarViewMac::GetPageActionDecoration(
685 ExtensionAction* page_action) { 690 ExtensionAction* page_action) {
686 DCHECK(page_action); 691 DCHECK(page_action);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 812
808 return zoom_decoration_->UpdateIfNecessary( 813 return zoom_decoration_->UpdateIfNecessary(
809 ui_zoom::ZoomController::FromWebContents(web_contents), 814 ui_zoom::ZoomController::FromWebContents(web_contents),
810 default_zoom_changed, IsLocationBarDark()); 815 default_zoom_changed, IsLocationBarDark());
811 } 816 }
812 817
813 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 818 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
814 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 819 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
815 OnDecorationsChanged(); 820 OnDecorationsChanged();
816 } 821 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698