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

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

Issue 1935663002: New origin security indicator icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shorten the Views GetSecureTextColor further, thanks to pkasting. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
52 #include "chrome/browser/ui/tabs/tab_strip_model.h" 52 #include "chrome/browser/ui/tabs/tab_strip_model.h"
53 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
54 #include "chrome/common/pref_names.h" 54 #include "chrome/common/pref_names.h"
55 #include "components/bookmarks/common/bookmark_pref_names.h" 55 #include "components/bookmarks/common/bookmark_pref_names.h"
56 #import "components/omnibox/browser/omnibox_popup_model.h" 56 #import "components/omnibox/browser/omnibox_popup_model.h"
57 #include "components/prefs/pref_service.h" 57 #include "components/prefs/pref_service.h"
58 #include "components/search_engines/template_url.h" 58 #include "components/search_engines/template_url.h"
59 #include "components/search_engines/template_url_service.h" 59 #include "components/search_engines/template_url_service.h"
60 #include "components/security_state/security_state_model.h"
60 #include "components/translate/core/browser/language_state.h" 61 #include "components/translate/core/browser/language_state.h"
61 #include "components/ui/zoom/zoom_controller.h" 62 #include "components/ui/zoom/zoom_controller.h"
62 #include "components/ui/zoom/zoom_event_manager.h" 63 #include "components/ui/zoom/zoom_event_manager.h"
63 #include "content/public/browser/web_contents.h" 64 #include "content/public/browser/web_contents.h"
64 #include "extensions/browser/extension_system.h" 65 #include "extensions/browser/extension_system.h"
65 #include "extensions/common/extension.h" 66 #include "extensions/common/extension.h"
66 #include "grit/components_scaled_resources.h" 67 #include "grit/components_scaled_resources.h"
67 #include "grit/theme_resources.h" 68 #include "grit/theme_resources.h"
68 #include "skia/ext/skia_utils_mac.h" 69 #include "skia/ext/skia_utils_mac.h"
69 #import "ui/base/cocoa/cocoa_base_utils.h" 70 #import "ui/base/cocoa/cocoa_base_utils.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 bool in_dark_mode = IsLocationBarDark(); 564 bool in_dark_mode = IsLocationBarDark();
564 565
565 SkColor vector_icon_color = gfx::kPlaceholderColor; 566 SkColor vector_icon_color = gfx::kPlaceholderColor;
566 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; 567 gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
567 int icon_size = kDefaultIconSize; 568 int icon_size = kDefaultIconSize;
568 if (ShouldShowEVBubble()) { 569 if (ShouldShowEVBubble()) {
569 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP; 570 vector_icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
570 vector_icon_color = gfx::kGoogleGreen700; 571 vector_icon_color = gfx::kGoogleGreen700;
571 icon_size = kMaterialSmallIconSize; 572 icon_size = kMaterialSmallIconSize;
572 } else { 573 } else {
573 vector_icon_id = omnibox_view_->GetVectorIcon(in_dark_mode); 574 vector_icon_id = omnibox_view_->GetVectorIcon();
574 if (in_dark_mode) { 575 if (in_dark_mode) {
575 vector_icon_color = SK_ColorWHITE; 576 vector_icon_color = SK_ColorWHITE;
576 } else { 577 } else {
577 vector_icon_color = OmniboxViewMac::BaseTextColorSkia(in_dark_mode); 578 security_state::SecurityStateModel::SecurityLevel security_level =
579 GetToolbarModel()->GetSecurityLevel(false);
580 vector_icon_color =
581 (security_level == security_state::SecurityStateModel::NONE)
582 ? OmniboxViewMac::BaseTextColorSkia(in_dark_mode)
583 : skia::NSDeviceColorToSkColor(OmniboxViewMac::GetSecureTextColor(
groby-ooo-7-16 2016/05/23 18:54:46 Question: If we pass in the security level anyways
palmer 2016/05/23 21:11:48 You mean have GetSecureTextColor call GetToolbarMo
groby-ooo-7-16 2016/05/23 23:34:01 No, I meant handling the ::NONE case in GetSecureT
584 security_level, in_dark_mode));
578 } 585 }
579 } 586 }
580 587
581 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE); 588 DCHECK(vector_icon_id != gfx::VectorIconId::VECTOR_ICON_NONE);
582 NSImage* image = NSImageFromImageSkiaWithColorSpace( 589 NSImage* image = NSImageFromImageSkiaWithColorSpace(
583 gfx::CreateVectorIcon(vector_icon_id, icon_size, vector_icon_color), 590 gfx::CreateVectorIcon(vector_icon_id, icon_size, vector_icon_color),
584 base::mac::GetSRGBColorSpace()); 591 base::mac::GetSRGBColorSpace());
585 592
586 location_icon_decoration_->SetImage(image); 593 location_icon_decoration_->SetImage(image);
587 ev_bubble_decoration_->SetImage(image); 594 ev_bubble_decoration_->SetImage(image);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 814
808 return zoom_decoration_->UpdateIfNecessary( 815 return zoom_decoration_->UpdateIfNecessary(
809 ui_zoom::ZoomController::FromWebContents(web_contents), 816 ui_zoom::ZoomController::FromWebContents(web_contents),
810 default_zoom_changed, IsLocationBarDark()); 817 default_zoom_changed, IsLocationBarDark());
811 } 818 }
812 819
813 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 820 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
814 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 821 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
815 OnDecorationsChanged(); 822 OnDecorationsChanged();
816 } 823 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h » ('j') | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698