Commit e3fa6750 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Add app-wide override for UIBarButtonItem tint color

Although our typical blue is pretty similar to the default system blue,
our blue in dark mode is somewhat different. Thus, we want to use our
blue on all buttons, etc.

To limit the possibility of errors, this change will be made in steps,
which is why this only changes the tint color of bar button items
inside a table view navigation controller.

Bug: 974255
Change-Id: Ic0aeb07e5f4177ffad2179183fd462a8e7634958
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696967Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Cr-Commit-Position: refs/heads/master@{#676862}
parent 9ec01246
......@@ -209,6 +209,7 @@ source_set("app_internal") {
"//ios/chrome/browser/sync",
"//ios/chrome/browser/tabs",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/appearance_customizer",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/browser_view",
"//ios/chrome/browser/ui/commands",
......@@ -223,6 +224,7 @@ source_set("app_internal") {
"//ios/chrome/browser/ui/signin_interaction",
"//ios/chrome/browser/ui/tab_grid",
"//ios/chrome/browser/ui/tab_grid:tab_grid_ui",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/tabs",
"//ios/chrome/browser/ui/toolbar:toolbar_ui",
"//ios/chrome/browser/ui/toolbar/public",
......
......@@ -111,6 +111,7 @@
#import "ios/chrome/browser/snapshots/snapshot_tab_helper.h"
#include "ios/chrome/browser/system_flags.h"
#import "ios/chrome/browser/tabs/tab_model.h"
#import "ios/chrome/browser/ui/appearance_customizer/appearance_customizer.h"
#import "ios/chrome/browser/ui/authentication/signed_in_accounts_view_controller.h"
#import "ios/chrome/browser/ui/browser_view/browser_coordinator.h"
#import "ios/chrome/browser/ui/browser_view/browser_view_controller.h"
......@@ -128,6 +129,7 @@
#include "ios/chrome/browser/ui/tab_grid/tab_grid_coordinator.h"
#import "ios/chrome/browser/ui/tab_grid/tab_switcher.h"
#import "ios/chrome/browser/ui/tab_grid/view_controller_swapping.h"
#import "ios/chrome/browser/ui/table_view/table_view_navigation_controller.h"
#import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h"
#import "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/top_view_controller.h"
......@@ -1324,8 +1326,11 @@ enum class EnterTabSwitcherSnapshotResult {
// Enables UI initializations to query the keyWindow's size.
[self.window makeKeyAndVisible];
CustomizeUIAppearance();
// Lazy init of mainCoordinator.
[self.mainCoordinator start];
_tabSwitcher = self.mainCoordinator.tabSwitcher;
// Call -restoreInternalState so that the grid shows the correct panel.
[_tabSwitcher restoreInternalStateWithMainTabModel:self.mainTabModel
......
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
source_set("appearance_customizer") {
sources = [
"appearance_customizer.h",
"appearance_customizer.mm",
]
deps = [
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/common/colors",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_APPEARANCE_CUSTOMIZER_APPEARANCE_CUSTOMIZER_H_
#define IOS_CHROME_BROWSER_UI_APPEARANCE_CUSTOMIZER_APPEARANCE_CUSTOMIZER_H_
#import <UIKit/UIKit.h>
// Overrides some default appearance values for UIKit controls.
void CustomizeUIAppearance();
#endif // IOS_CHROME_BROWSER_UI_APPEARANCE_CUSTOMIZER_APPEARANCE_CUSTOMIZER_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/appearance_customizer/appearance_customizer.h"
#import "ios/chrome/browser/ui/table_view/table_view_navigation_controller.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
void CustomizeUIAppearance() {
Class containerClass = [TableViewNavigationController class];
UIBarButtonItem* barbuttonItemAppearance = [UIBarButtonItem
appearanceWhenContainedInInstancesOfClasses:@[ containerClass ]];
barbuttonItemAppearance.tintColor = [UIColor colorNamed:kTintColor];
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment