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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 1955083003: [Material Design] Update Website Setting Icons in Omnibox on OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for shrike's review 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index f0ef51cf3c826e244e52dd1ac08a65845e6c34ea..c8aedec6ccff2c94107ab6326820efd5292eb0b6 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -207,8 +207,7 @@ void LocationBarViewMac::UpdateSaveCreditCardIcon() {
bool enabled = controller && controller->IsIconVisible();
command_updater()->UpdateCommandEnabled(IDC_SAVE_CREDIT_CARD_FOR_PAGE,
enabled);
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
- save_credit_card_decoration_->SetIcon(in_dark_mode);
+ save_credit_card_decoration_->SetIcon(IsLocationBarDark());
save_credit_card_decoration_->SetVisible(enabled);
OnDecorationsChanged();
}
@@ -344,15 +343,13 @@ void LocationBarViewMac::SetStarred(bool starred) {
if (star_decoration_->starred() == starred)
return;
- star_decoration_->SetStarred(starred,
- [[field_ window] inIncognitoModeWithSystemTheme]);
+ star_decoration_->SetStarred(starred, IsLocationBarDark());
UpdateBookmarkStarVisibility();
OnDecorationsChanged();
}
void LocationBarViewMac::SetTranslateIconLit(bool on) {
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
- translate_decoration_->SetLit(on, in_dark_mode);
+ translate_decoration_->SetLit(on, IsLocationBarDark());
OnDecorationsChanged();
}
@@ -563,7 +560,7 @@ void LocationBarViewMac::UpdateWithoutTabRestore() {
}
void LocationBarViewMac::UpdateLocationIcon() {
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
+ bool in_dark_mode = IsLocationBarDark();
SkColor vector_icon_color = gfx::kPlaceholderColor;
gfx::VectorIconId vector_icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
@@ -603,8 +600,8 @@ void LocationBarViewMac::UpdateColorsToMatchTheme() {
// Make sure we're displaying the correct star color for Incognito mode. If
// the window is in Incognito mode, switching between a theme and no theme
// can move the window in and out of dark mode.
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
- star_decoration_->SetStarred(star_decoration_->starred(), in_dark_mode);
+ star_decoration_->SetStarred(star_decoration_->starred(),
+ IsLocationBarDark());
// Update the appearance of the text in the Omnibox.
omnibox_view_->Update();
@@ -656,6 +653,10 @@ bool LocationBarViewMac::ShouldShowEVBubble() const {
security_state::SecurityStateModel::EV_SECURE);
}
+bool LocationBarViewMac::IsLocationBarDark() const {
+ return [[field_ window] inIncognitoModeWithSystemTheme];
+}
+
NSImage* LocationBarViewMac::GetKeywordImage(const base::string16& keyword) {
const TemplateURL* template_url = TemplateURLServiceFactory::GetForProfile(
profile())->GetTemplateURLForKeyword(keyword);
@@ -795,9 +796,8 @@ void LocationBarViewMac::UpdateTranslateDecoration() {
bool enabled = language_state.translate_enabled();
command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled);
translate_decoration_->SetVisible(enabled);
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
translate_decoration_->SetLit(language_state.IsPageTranslated(),
- in_dark_mode);
+ IsLocationBarDark());
}
bool LocationBarViewMac::UpdateZoomDecoration(bool default_zoom_changed) {
@@ -805,11 +805,9 @@ bool LocationBarViewMac::UpdateZoomDecoration(bool default_zoom_changed) {
if (!web_contents)
return false;
- bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
return zoom_decoration_->UpdateIfNecessary(
ui_zoom::ZoomController::FromWebContents(web_contents),
- default_zoom_changed,
- in_dark_mode);
+ default_zoom_changed, IsLocationBarDark());
}
void LocationBarViewMac::OnDefaultZoomLevelChanged() {

Powered by Google App Engine
This is Rietveld 408576698