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

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

Issue 1909453004: [Mac][Material Design] Adjust EV chip to match Material Design spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 omnibox_view_->OnTabChanged(contents); 547 omnibox_view_->OnTabChanged(contents);
548 else 548 else
549 omnibox_view_->Update(); 549 omnibox_view_->Update();
550 OnChanged(); 550 OnChanged();
551 } 551 }
552 552
553 void LocationBarViewMac::UpdateWithoutTabRestore() { 553 void LocationBarViewMac::UpdateWithoutTabRestore() {
554 Update(nullptr); 554 Update(nullptr);
555 } 555 }
556 556
557 void LocationBarViewMac::UpdateLocationIcon() { 557 void LocationBarViewMac::UpdateLocationIcon() {
tapted 2016/04/22 00:41:52 Should this be UpdateMaterialLocationIcon? I had t
558 bool inDarkMode = [[field_ window] inIncognitoModeWithSystemTheme]; 558 bool inDarkMode = [[field_ window] inIncognitoModeWithSystemTheme];
559 559
560 SkColor vectorIconColor = gfx::kPlaceholderColor; 560 SkColor vectorIconColor = gfx::kPlaceholderColor;
561 gfx::VectorIconId vectorIconId = gfx::VectorIconId::VECTOR_ICON_NONE; 561 gfx::VectorIconId vectorIconId = gfx::VectorIconId::VECTOR_ICON_NONE;
562 const int kIconSize = 16; 562 int iconSize = 16;
tapted 2016/04/22 00:41:52 these should all be hacker_style const int kDefau
shrike 2016/04/22 05:46:30 By "hacker_style" you mean with underbars? This is
tapted 2016/04/22 06:09:48 yup - underbars. And the naming scheme for Objecti
shrike 2016/04/22 06:24:15 Ah, OK, I see where I was confused. Thanks.
563 if (ShouldShowEVBubble()) { 563 if (ShouldShowEVBubble()) {
tapted 2016/04/22 00:41:52 Hm. could this even move into ev_bubble_decoration
shrike 2016/04/22 05:46:30 In general the icon does not change but that's not
tapted 2016/04/22 06:09:48 wouldn't that need handling for `vectorIconColor`
shrike 2016/04/22 06:24:15 The vector icon code is a little screwy (if you as
tapted 2016/04/25 21:48:10 Acknowledged.
564 vectorIconId = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP; 564 vectorIconId = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
565 vectorIconColor = gfx::kGoogleGreen700; 565 vectorIconColor = gfx::kGoogleGreen700;
566 iconSize = 12;
566 } else { 567 } else {
567 vectorIconId = omnibox_view_->GetVectorIcon(inDarkMode); 568 vectorIconId = omnibox_view_->GetVectorIcon(inDarkMode);
568 if (inDarkMode) { 569 if (inDarkMode) {
569 vectorIconColor = SK_ColorWHITE; 570 vectorIconColor = SK_ColorWHITE;
570 } else { 571 } else {
571 NSColor* textColor = OmniboxViewMac::BaseTextColor(inDarkMode); 572 NSColor* textColor = OmniboxViewMac::BaseTextColor(inDarkMode);
572 // Convert to the device color space before getting the SkColor. 573 // Convert to the device color space before getting the SkColor.
573 textColor = [textColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; 574 textColor = [textColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
574 vectorIconColor = skia::NSDeviceColorToSkColor(textColor); 575 vectorIconColor = skia::NSDeviceColorToSkColor(textColor);
575 } 576 }
576 } 577 }
577 578
578 DCHECK(vectorIconId != gfx::VectorIconId::VECTOR_ICON_NONE); 579 DCHECK(vectorIconId != gfx::VectorIconId::VECTOR_ICON_NONE);
579 NSImage* image = NSImageFromImageSkia(gfx::CreateVectorIcon( 580 NSImage* image = NSImageFromImageSkia(gfx::CreateVectorIcon(
580 vectorIconId, kIconSize, vectorIconColor)); 581 vectorIconId, iconSize, vectorIconColor));
581 582
582 location_icon_decoration_->SetImage(image); 583 location_icon_decoration_->SetImage(image);
583 ev_bubble_decoration_->SetImage(image); 584 ev_bubble_decoration_->SetImage(image);
584 585
585 Layout(); 586 Layout();
586 } 587 }
587 588
588 void LocationBarViewMac::UpdateColorsToMatchTheme() { 589 void LocationBarViewMac::UpdateColorsToMatchTheme() {
589 if (!ui::MaterialDesignController::IsModeMaterial() || 590 if (!ui::MaterialDesignController::IsModeMaterial() ||
590 ![[field_ window] inIncognitoMode]) { 591 ![[field_ window] inIncognitoMode]) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 return zoom_decoration_->UpdateIfNecessary( 800 return zoom_decoration_->UpdateIfNecessary(
800 ui_zoom::ZoomController::FromWebContents(web_contents), 801 ui_zoom::ZoomController::FromWebContents(web_contents),
801 default_zoom_changed, 802 default_zoom_changed,
802 inDarkMode); 803 inDarkMode);
803 } 804 }
804 805
805 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 806 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
806 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 807 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
807 OnDecorationsChanged(); 808 OnDecorationsChanged();
808 } 809 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698